1
00:00:06,580 --> 00:00:09,169
The main command for
creating users is useradd.

2
00:00:10,250 --> 00:00:15,089
If you're on Ubuntu, it's important to use
userad m because on Ubuntu users do not get

3
00:00:15,089 --> 00:00:19,929
a home directory by default. And really you
want your users to have a home directory.

4
00:00:20,589 --> 00:00:23,850
So don't forget the
m option on Ubuntu.

5
00:00:24,870 --> 00:00:30,550
You will also find that alternative commands are
available instead of useradd. There's also add user.

6
00:00:31,530 --> 00:00:37,310
But I would advise you focus on one command. Why would you
want to learn about different commands to do the exact same thing?

7
00:00:38,670 --> 00:00:44,825
When users are created default settings from the
file etc login.devs are applied and if login.devs

8
00:00:44,825 --> 00:00:50,980
file is an important file, you should consider
changing settings in it before creating the users.

9
00:00:51,619 --> 00:00:57,750
And that is because once you have changed
settings, they won't be applied for existing users.

10
00:00:59,000 --> 00:01:05,069
You can also use userad D to
get an overview of currently effective default settings.

11
00:01:05,799 --> 00:01:07,439
Let me show you how
to use all of this.

12
00:01:09,620 --> 00:01:15,420
Let's start with the sudo useradd d where
we can see some of the default settings.

13
00:01:16,420 --> 00:01:19,980
So what are these default settings? So
that is actually funny. Group is 100.

14
00:01:21,340 --> 00:01:27,359
That is not true Shell has been bashed. That
is true. Skel is etc skelled that is also true.

15
00:01:28,180 --> 00:01:31,865
This etc skel is a
sk directory and the contents of

16
00:01:31,865 --> 00:01:35,550
the skeleton directory will be
copied into the user home directory.

17
00:01:36,150 --> 00:01:39,965
Much more important than
the output of user AT

18
00:01:39,965 --> 00:01:43,780
D is the contents
of this file etclogin devs.

19
00:01:45,760 --> 00:01:48,040
There you will
find login definitions.

20
00:01:48,700 --> 00:01:52,900
Notice that many items in
the file show as not supported.

21
00:01:53,439 --> 00:01:59,115
That is because behind user configuration there's a
more advanced system with the name pam. As spam

22
00:01:59,115 --> 00:02:04,790
is taking care of things, then the functionality
is taken out of the etc login devs.

23
00:02:05,290 --> 00:02:09,569
So as you can see there's a
lot of not supported. But if you scroll

24
00:02:09,569 --> 00:02:13,849
down a little bit right here we
do see some parameters that are important.

25
00:02:14,509 --> 00:02:19,289
Pass max days. That is definitely
a value that you want to change.

26
00:02:19,810 --> 00:02:25,905
Because if a user password is set,
then the user password according to this value

27
00:02:25,905 --> 00:02:32,000
is valid for 99,999 days. For your
information, that is that's about 272 years.

28
00:02:32,560 --> 00:02:33,599
I think
that's too much.

29
00:02:34,150 --> 00:02:38,909
So change that to 99 to
make it a little bit more secure.

30
00:02:39,930 --> 00:02:45,615
There are other parameters as well, like
the userid max and the gid max

31
00:02:45,615 --> 00:02:51,300
and min which is identifying where user
IDs and group IDs should be starting.

32
00:02:51,819 --> 00:02:54,240
Let's not do that right now.
Let's just keep it as it is.

33
00:02:54,780 --> 00:03:00,435
And add a user. User add Anna and
oh boy, does that make sense. Of course

34
00:03:00,435 --> 00:03:06,090
that makes sense, because we want to add
a user and that requires super user privileges.

35
00:03:07,069 --> 00:03:14,050
Now this creates user Anna and if any relevant values were
changed in the etc login.dev they will be applied as well.

36
00:03:14,810 --> 00:03:19,909
Honestly, I didn't change any relevant
values, but I can show you sudo

37
00:03:19,909 --> 00:03:25,009
passwd anna and then I'm going
to enter the new password twice.

38
00:03:25,509 --> 00:03:29,814
And now I'm going to
use sudo till minus 55 on

39
00:03:29,814 --> 00:03:34,120
etc shadow. That's the file
where user passwords are stored.

40
00:03:34,740 --> 00:03:38,439
Now what do we see?
We see for lynda there is

41
00:03:38,439 --> 00:03:42,139
a value of 99,999. For
Anna there's a value of 99.

42
00:03:43,539 --> 00:03:48,659
This is the maximum password validity
that I just changed in etc login.devs.
