An account is one line in the file /etc/passwd. No line, no user, however many directories with that name lie on the disk.
getent passwd name prints the line. Its fields are separated by colons:
| Field | For student |
|---|---|
| name | student |
| password | x — the password itself is kept in /etc/shadow |
| UID and primary group GID | 1000, 1000 |
| comment | empty |
| home directory | /home/student |
| login shell | /bin/bash |
For newhire getent printed nothing: there is no such line. The kernel stores a file's owner as a number, and ls and id take the name from this list. UID 1500 has no line, so ls -l printed the number. This happens after sudo userdel name: without the -r option it removes the line and leaves the home directory on disk.
The login shell is the program the system starts when the user logs in. Usually it is /bin/bash.
Which program will the system start when deploy logs in?
deploy:x:1001:1001::/home/deploy:/bin/sh
-
The last field of the line sets the login shell, and deploy has
/bin/shthere./bin/bashis in student's line. -
xmeans the password is kept in/etc/shadow. Whether there is one,sudo passwd -S deployshows. -
That is the home directory, the sixth field: the login moves into it. The program it starts comes from the last field.
The line's last field is the login shell, and deploy's is /bin/sh. sudo usermod -s /bin/bash deploy would change it.
Key points
-
An account is a line in
/etc/passwd: name, UID, GID, home directory, and login shell. -
A directory in
/homedoes not create an account and means nothing without one.