[Intro Music]
We have just explored how to create
new users using such command as
'useradd', and using corresponding
'userdel' command, we have deleted
users. Now let me explain you how
you could create a new user using
command 'adduser'. And also
afterwards, I'll tell you how to
create new groups and assign users
to some custom groups. Because by
default, Linux creates a group with
the same name as username you
create. Alright, let's now enter,
'adduser' command; and next,
let's type username of the user I
want to create. And here you'll see
some prompts. First of all, you'll
see that new user was added. After
that new group, 'bogdan' was created.
And here in parenthesis, you'll see
actually ID for specific user,
because every user has specific
ID. Next, you see that new user
'bogdan' was assigned to 'bogdan'
group. Afterwards new home directory
was created automatically, and path
to this directory is here,
'/home/bogdan'. And next, after
this step, you new files were
copied into the home directory for
this user. And basically here after
this command, you will see the same
three files that we have seen in
the previous lecture after 'useradd'
command. And here, we are
immediately prompted to create a
new password for this user. And you
see that this command 'adduser' is
actually interactive conversation
for creation of the new user. All
right, let's enter here new
password. Again, let me choose some
something really strong, '123'; retype '123'.
And you'll see that password was
updated successfully. Afterwards,
you could set such parameters as
'Full Name', 'Room Number', 'Work Phone',
'Home Phone', 'Other'; and if this
information is correct, just simply
type Yes, and press Enter; or just
press Enter. And now we're all set,
new user 'bogdan' was successfully
created. Let's verify that. Let's
clear terminal. And first let's
have a look at contents of the home
directory. And here I see new
folder 'bogdan'. And it's a good
sign, it seems that this new home
directory was created
automatically. Let's have a look at
contents of this directory; and
let's add here options '-la'; and
I'll see three hidden files, '.bash_logout',
'.bashrc', and '.profile'; and
notice username and group for
those three files. You see that
owner and group for all files is
set to new user, 'bogdan'; and
that means that this user has full
access to those files. Actually,
here you see permissions for every
file; and this user 'bogdan' is
able to read, write, but not execute;
other group users are able only to
read those files; and remaining users
are also able only to read those
files. And that means that any
other users will not be able to modify
those files like '.bash_logout', '.bashrc',
and profile. Alright, that's how
this home directory looks like for
this particular newly created user.
Let me now clear terminal and enter
following command, 'cat /etc/
passwd', let's press Enter, and here
in output of this command at the
very end, I'll see information
about newly created user. Here I
see username, here is User ID, it is
1000, next comes path to home
directory for this particular user,
and finally, you see default shell
for this user. And here in this
case, you see that this default
shell was set to 'bash' shell. And
that is the difference between 'adduser'
and 'useradd' command. We have
seen that in 'useradd' command
default shell is set to 'sh', but when
you create a new user using
'adduser' command, then default shell
will be set to 'bash', and the reason
for that is that initial default
configuration settings are located
in other file if you use 'adduser'
command. Let me show you location
of this file. Let me clear terminal
and type 'cat /etc/adduser' first
step, and you'll see that file name
will be autocompleted to
'adduser.conf'. Let's have a look at the
contents of this configuration
file. And here in this output let's
find the setting for bash shell, it
should be somewhere at the
beginning. And yes, here is the
setting 'DSHELL=/bin/
bash'; and that means that default
shell for all users that are
created using 'adduser' command will be set to 'bash'.
And actually, you're able to modify
this configuration file, same as we
did with configuration file for
'useradd' command, if you want, of
course. Alright, that's how this
configuration file looks like. And
that's how we have just created a
new user using 'adduser' command.
Great. Let's now try to login as
'bogdan' user. Let's type 'su
-', and next comes 'bogdan',
please recap that '-' stands for
'-' option or '-l' or '--
login' option. And with this option,
we will login into the home
directory for a particular user.
Let's press Enter, type 'pwd', and yes,
now I'm inside of the home
directory for 'bogdan' user. And
here you see that the command prompt was
changed. And here now I see new
user 'bogdan'. If I enter 'whoami',
I'll see same output here.
Great. That is how we were able to
login under custom user that we
have just created. And of course,
now I'm able to create some files
in this home directory. Let's
create a new file, let's say '1.txt',
and let's list contents
of home directory. And I'll see
newly created file. And you'll see
that owner of this file is of course
'bogdan'. And here you see
'bogdan' because it is the name of the
group that was automatically
created for new user 'bogdan'.
And here are permissions for this
newly created file. Alright, that's
how we are able to interact with
system under custom user. And next
let's talk a bit about permissions
for files. And in the next lecture,
I'll try to create a new file as
root user, and afterwards try to
modify this file under 'bogdan's'
account. Let's try that in the next
lecture. Bye-Bye.
[no audio]