Configuring user accounts
As I already said, it is bad practice to run all programs as root
because if one program is compromised by an outside attack then the whole system is at risk. It is better to create unprivileged user accounts and use them where full root
is not necessary.
Usernames are configured in /etc/passwd
. There is one line per user with seven fields of information separated by colons. These are, in order:
- The login name
- The hash code used to verify the password or, more usually, an
x
to indicate that the password is stored in/etc/shadow
- The UID or user ID
- The GID or group ID
- The comment field (often left blank)
- The user’s home directory
- The shell this user will use (optional)
Here is a simple example in which we have the user root
with UID 0 and the user daemon
with UID 1:
root:x:0:0:root:/root:/bin/sh
daemon:x:1:1:daemon:/usr/sbin:/bin/false
Setting the shell for the user daemon
as /bin/false...