Jan 2, 2009 admin

Notes on Unix and Linux user admin such as managing users and groups.

Users and Groups

add user to secondary group

# usermod -a -G <GROUP> <USER>
# usermod -a -G ftp tony

add new user (Debian only), easy version of useradd.

# adduser <USER> <GROUP>

/etc/adduser.conf : Default configuration for new users.

create group (Debian only), easy version of groupadd.

# addgroup <GROUP>

Special files

/etc/passwd: contains user’s name and shell.


<username>:<encrypted password>:<UID>:<GID>:<fullname>:<homedir>

To disable account without deleting it, prepend * in password field. In Linux, it might be “!” instead of “*”. Also this can be done via passwd command


/etc/shadow: Encrypted user’s passwords. This corresponds exactly to /etc/passwd file.

/etc/group: Contains lists of all the groups and the user that belongs to that group.


<group name>:<password>:<GID>:<users>


Other Commands

deluser: Delete user (or userdel on some other system). To disable account, see ‘/etc/passwd’

passwd [user]: Change user’s password. Only root can change other user’s password.

Monitor user activity

TTY, Console

tty or who or w :find out which tty/vcs/pts I am on.

$ tty

$ who
vagrant  pts/0        2016-03-01 17:03 (

$ w
18:00:11 up  1:02,  1 user,  load average: 0.00, 0.01, 0.01
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
vagrant  pts/0         17:03    0.00s  0.06s  0.00s w