After a user account has been added to your system, you
can modify that user's settings using vedituser,
chpass, passwd,
or pw.
vedituser
vedituser can be
used in two ways, either through a wizard, or by passing the user information
with the command.
dding a User without prompting
To edit a user without prompting, use the following for
example:
vedituser --login= --password=5pwd --fullname="
Schmoe"
--services=ftp,mail --quota=50
vedituser --login= --password=5pwd --fullname="
Schmoe"
--services=ftp,shell,e-mail,web --shell=bash --quota=50
Edit a User using the Wizard
To edit a user using the wizard interface type the
following at the command prompt:
# vedituser
The following is an example of the wizard version of vedituser:
gluttony ~# vedituser
Enter username to edit: bob
Now, enter the full name for this E-mail/FTP account.
Full Name: [Bob]:
Please select the services that this account will be using:
e-mail e-mail services
ftp FTP services
shell shell login
web HTTP (web) services
Enter the service name (e.g., "ftp",
"mail", etc.) to toggle that service for the account. Hit
<return> when you are done selecting/deselecting services for this user.
Select/deselect services [ftp shell web]:
Select a shell from the following list:
bash
csh
ksh
ksh93
sh
tcsh
zsh
Enter a shell: [tcsh]:
Enter filesystem quotas for this user. The quota should be
an integer (no decimal fractions) in megabytes (e.g., 5 = 5 megabytes). Enter 0
for no quota.
Quota (in megabytes) [25]: 0
See the vedituser
man page for more information.
chpass
chpass is a command
useful for changing certain information in password files.
If you use chpass as
root, your default editor will open (pico,
vi, emacs,
ee) with the following information:
The following is an example of the chpass command:
# chpass
#Changing user database information for
Login:
Password: $1$uAGNRKJP$4.JUH2Q.wftt9GiwBSsNL.
Uid [#]: 1002
Gid [# or name]: 1002
Change [month day year]:
Expire [month day year]:
Class:
Home directory: /home/
Shell: /usr/local/bin/bash
Full Name: Joseph Schmoe, Jr.
Office Location:
Office Phone:
Home Phone:
Other information:
The root user may change any of this information.
If you run chpass as the user (), you may only change a
limited amount of information:
#Changing user database information for .
Shell: /usr/local/bin/bash
Full Name: Joseph Schmoe, Jr.
Office Location:
Office Phone:
Home Phone:
Other information:
chpass, despite its
name, is usually not the program you want to run to change someone's password.
For changing passwords, you should use passwd
instead.
passwd
You can use the passwd
program to change a user's password. When you type passwd as root, you are prompted twice for the root
new password.
# passwd
Changing local password for
New password:
Retype new password:
passwd: updating the database...
passwd: done
If you type passwd
as a user, you are prompted for your present password first, then your new
password. This is a security feature to prevent unauthorized users from
changing user passwords from an unattended terminal:
% passwd
Changing local password for
Old password:
New password:
Retype new password:
passwd: updating the database...
passwd: done
Once run, the password for Joe becomes the new password.
Note: When you su to a different user and try to change the
password of the user that you su to, you
will need to provide the username of the person after the passwd command. For
example:
pw
Changing user account information interactively is best
accomplished with either the chpass or passwd commands. However, when you want a quick
one-liner to fix an account, or if you need to automate account modification, pw is your program.
Here are some practical uses for pw:
-
Changing user's name:
# pw user mod -c "Joseph Carmichael Schmoe" joe
-
Changing user's password (be careful--it doesn't ask twice!):
# pw user mod -h 0
New password for user :
-
Changing user's login shell:
# pw user mod -s /usr/local/bin/tcsh
-
Adding a user to another group:
# pw user mod -G web
-
Removing a user from a group (in this case, the 'web' group):
# pw user mod -G
The -G option
removes the user from all groups except the ones listed after -G (each group should be separated by commas).
|