chfn
[ -f full-name ][ -o office ][ -p office-phone ] [ -h home-phone ] [ -u ] [ -v ] [ username ]
This command is used to change the information displayed when someone fingers you. If no information is entered on the command line, chfn will prompt you interactively for each field.
Example: To change your name as stored on the system, use
chnf -n "John Q. Public"
Example: To change your home phone as stored on the system, use
chfn -h 1234567890
-f, --full-name | Enter your real name. |
-o, --office | Enter office or room number. |
-p, --office-phone | Enter office phone number. |
-h, --home-phone | Enter home phone number. |
-u, --help | Display help information and exit. |
-v, --version | Display version information and exit. |
chpasswd
[-e]
This command accepts a list of user name and password pairs from standard input and uses the information to update the passwords of existing users. The input lines are formatted as
user:password
Example: After you've set up the file "newpasswords" containing the user name password pairs, use chpasswd to update the password information on the system:
chpasswd < newpasswords
Use this command on a security-conscious system to do periodic bulk updating of passwords. |
It is a terrible idea to store unencrypted passwords anywhere on the system. |
-e | Specify that the input password will already be encrypted. |
finger
[-lmsp] [user ] [user@host ]
This command displays information about system users.
Example: To find out if user dsatter is logged on, use
finger dsatter
This might produce output similar to the following:
Login: dsatter Name:
Directory: /home/dsatter Shell: /bin/bash
On since Sat Jul 24 10:42 (EDT) on tty1
No mail.
Plan:
Go away and leave me alone.
If you keep a file called .plan in your home directory, the contents of that file will be displayed when someone fingers you. The original intent was to provide a mechanism for letting people know you were at lunch, what you were working on, etc., but in practice it's become a window into the personality of the user, not unlike the .signature file in e-mail. |
-s | Display login name, real name, terminal name, write status, idle time, login time, office location, and office phone number. |
-l | Display a multi-line output, including all the information included with the -s option and also user's home directory, home phone number, login shell, mail status, and (finally) the contents of their .plan, .project, and .forward files. |
-p | Suppress printing of the .plan and .project files. |
-m | Suppress matching of the user argument to user's real names. |
groupmod
[-g gid [-o]] [-n group_name ] group
Modify the system account files pertaining to group information.
Example: To change the name of the group "chem" to "chemistry" (-n option) and at the same time make their new group id be 127 (-g option):
groupmod -g 127 -n chemistry
-ggid | Specify a new numeric group ID. By default, this value must be unique. Values less than 100 are reserved for system groups (by convention). Values may not be negative. |
-o | Permit use of nonunique group IDs. |
-ngroup_name | Specify a new name for the group. |
groups
[USERNAME]
Display group information for the specified user.
Example: To display information about all groups user shae belongs to, use
groups shae
-help | Display help information and exit. |
--version | Display version information and exit. |
grpck
[-r] [group shadow]
Check the entries in /etc/group and /etc/gshadow for validity (i.e., for proper format and valid data).
Example: To test your group file for validity without modifying anything, use
grpck
-r | Read-only mode. |
id
[OPTION] [USERNAME]
Display user and group id information for the specified user or, if no user is specified, the running process.
Example: To display user and group information for the user Michael, use
id michael
Example: To display the group id of the user susie, use
id -g susie
-g, --group | Restrict output to group id only. |
-G, --groups | Display supplementary groups only. |
-n, --name | Display user or group name rather than ID number. Must be used with one of -u, -g, or -G. |
-r, --real | Display real, rather than effective, user or group id. |
-u, --user | Display the user id only. |
passwd
[-u] [username]
Change the specified user's password. You must be root to run this command on any user other than yourself.
Example: If you're root, you can change Timmy's password by entering
passwd timmy
and entering the new password two times as prompted.
Example: Even if you're not root, you can reset your own password by entering:
passwd
-u | Only update expired passwords. |
pwck
[-r] [passwd shadow]
Check the entries in /etc/passwd and /etc/shadow for validity.
Example: If you're root, you can verify the integrity of your password file by entering
pwck
Example: To check the validity of your password file without changing anything, type:
pwck -r
-r | Read-only mode. |
su
[OPTION] [USER [ARG] ]
Change identity to the specified user or, with no options, become a superuser.
Example: To become a superuser, enter
su
and give the proper password at the prompt.
Example: To assume the user id of shawkins without changing your current environment variables, enter
su shawkins
and give the proper password for shawkins at the prompt.
Example: To assume the user id of shawkins, replacing all your current environment variables with those of shawkins, use
su - shawkins
-cCOMMAND,--command=COMMAND' | Run the specified command as the specified user without starting an interactive shell. |
-, -l, --login | Make the shell a login shell. That is, the new shell will behave as if you had just logged in from a blank terminal as the specified user. |
-m, -p, --preserve-environment | Do not change HOME, USER, LOGNAME, or SHELL environment variables. |
-sSHELL,--shell=SHELL | Run the specified shell rather than the shell from the user's password entry. |
useradd
[-c comment] [-d home_dir] [-e expire_date] [-f inactive_time] [-g initial_group] [-G group[, ]] [-m [-k skeleton_dir] | -M] [-s shell] [-u uid [ -o]] [-n] [-r] login
useradd -D
[-g default_group] [-b default_home] [-f default_inactive] [-e default_expire_date] [-s default_shell]
This command is used to create a new user account on the system. The user must supply a login name, but all other values are optional.
Example: To create a user "mary", with home directory (-d option) of /home/mary, shell (-s option) /bin/bash, and group (-g option) "chemistry", use the command
useradd -g chemistry -s /bin/bash -d /home/mary mary
Then use the passwd command to give her a new password. |
If you're the system administrator on a busy multiuser system, it will effectively add years to your life to write a script that will add new users with a minimum of work on your part (prompt with defaults for username, phone, home directory, etc.). If you're not the system administrator on a multiuser system, you should do this anyway for practice. |
-c comment | Specify a value for the comment field of the password file. |
-d home_dir | Specify the new user's home directory. |
-e expire_date | Specify a date on which the new user account will cease to work. expire_date is of the format MM/DD/YY. |
-f inactive_days | Specify how long to wait after a password expires before the account becomes disabled. |
-ginitial_group | This field contains the group name or number of the user's initial login group. |
-Ggroup,[...] | Define the user's supplementary groups. |
-m | When this option is invoked, the user's home directory will be created if it does not already exist. |
-M | Force useradd to NOT create the user's home directory. |
-n | Tell useradd NOT to create a group corresponding to the new user's user name. |
-r | Specify that the new user is a system account. (System accounts have UID values less than UID_MIN.) |
-sshell | Specify a login shell for the user. |
-uuid | Specify a numerical UID value. |