- So we have just created Users as well as Groups.
We haven't really talked about properties
for the Users and Groups.
So let's go explore.
Users and their properties
are stored in the file /etc/passwd.
And for the users, the following properties are used.
It starts with the username, of course.
And after that there is the UID.
The UID is the unique user ID.
And behind the scenes,
Linux is only using the user ID.
It's not using username.
That's just for convenience for us people
to add the username.
I will show you in the next lesson
how exactly that works.
Now we have the GID.
Now the interesting thing is that in /etc/passwd
there is place to store one GID.
And that's the group ID of the primary group.
So primary group membership is administered
in the GID fields in /etc/passwd.
Then there is the so-called GECOS field,
which stands for
General Electric Common Object Subscription.
That's referring to 1970-something
when General Electric created their own Unix distribution.
Nowadays people also call this the common field
and you can use it to add an additional description
for the user.
The Home directory is the next one.
That is what refers to the default directory
where the user will land after logging in.
Or the default directory
where the user is allowed to create files
or even both of them.
And last there is the Shell.
The Shell is the program that is started after login.
And in many cases, the Shell will be /bin/bash
if we need a user to login, of course.
Now, if you want to list current properties for a user
you can use getend passwd on that username.
Notice that passwords are not stored in /etc/passwd.
They are stored in a separate configuration file,
/etc/shadow.
For the simple reason that /etc/shadow
has a higher level of security.
If ever you would want to edit these files directly,
which I would advise against,
then you can use the vipw.
vipw is opening these files
and it's adding some checks.
So, it's preventing you from creating bad mistakes
to the configuration files.
Because bad mistakes to these configuration files
might have the result that nobody can log in anymore.
Let's have a look at these properties.
We start with sudo getend passwd bill,
which is showing what,
well, this is basically showing the line
from passwd for user bill.
getend is an interesting command.
getend is a command that will get information
from an administrative database
and the administrative database here is passwd.
Now, the thing is that behind Linux,
you can also configure the Linux
to get user information from somewhere else.
And if you have done that,
then getend passwd
will allow you to get the user information
from somewhere else, like an LDAP server.
But in a case of standalone Linux configuration
like we have done here,
getend is not really adding very much
and you might as well use grep bill /etc/passwd
for the same results.
So, what do we see?
Username, the x is a reference to the encrypted password
in /etc/shadow.
The user ID, the group ID,
nothing, which is the GECOS field,
bill has no comment.
/home/bill, which is the home directory
and /bin/bash, which is the shell.
Now, if you use vipw I'm going to show you vipw anyway
even if I have no intention to edit
then I'm getting an error message.
That makes sense because vipw
needs to be used with escalated privilege.
And what do we see?
We see beautiful colors to start with.
And we see the configuration for many of these system users.
Let's pick out a random user like geoclue.
What do I need you to see about geoclue?
Well, third field,
the user ID of geoclue is lower than 1,000.
That's a convention for system user IDs.
They have a user ID lower than 1,000.
Then we have the home directory /var/lib/geoclue.
That is the environment
where this user is allowed to write files.
And lastly, the default shell
which is set to /sbin/nologin.
This is a system user
and no matter what is happening,
if anything is going wrong,
you want it to be completely
impossible for this user to open a shell.
There's another user, the sync user,
and the sync user look at the shell.
It has /bin/sync as a default shell.
Which means that if this user is going to log in,
there is one thing that's going to happen.
And that is going to start the sync command.
So know an interactive shell, like the bash shell,
which we see for the ordinary users near the end.
Know just a standard command that is going to be running.
But most of these system users have nologin as their shell.
Now we also have these groups
and groups can have properties as well.
And the group properties are stored in the file /etc/group.
Users that are a group member as a secondary group
are also in /etc/group.
Notice that the primary group membership,
as we have already discussed,
is uniquely administered through /etc/passwd
So you will see the primary groups defined in /etc/group
but you won't see group membership in there.
Groups do not have significant other properties.
And if you want to have a look at it or edit it
you can use vigr.
vigr for
vi the group file.
Let's have a quick look /etc/group
and I'm just going to do that by using sudo vigr.
And there we go, here are the different groups.
Now here, we have a nice example
of the wheel group which the group ID,
as well as the name of the students
who are a member of this group
by secondary group assignment.
And for the rest of it,
nothing really interesting happening.
It's just the group and the group ID.
The x, by the way, is for the group password.
Forget about it.
This was used a long time ago.
It's not used anymore.
Sometimes you will see that on Linux
that certain parameters are still available
for backward compatibility.
But they're not really used anymore.
Like the group password, for instance.