-G grp1,grp2,... Supplementary group membership  
-M Don't create a home directory useradd only.
-m Create a home directory if it doesn't exist This is the default action.
-p cryptpass Set encrypted password to cryptpass Useful when copying accounts from an old system configuration.
-s shell Sets the user's shell to shell  
-u uid Set the numeric user ID to uid Useful when copying accounts from an old system configuration or synchronizing with old NFS servers.
-L Lock account against login usermod only.
-U Unlock account and permit login usermod only.

To set Jane's full name when her account is created, execute:

# useradd -c ' Jane Smith ' jane

usermod works in a similar way to useradd , but is used to adjust the parameters of existing accounts. For example, to change Jane's full name:

# usermod -c ' Jane Lee ' jane

As you'd expect, the userdel command deletes a user. The -r option specifies that the user's home directory and mail spool ( /var/spool/mail/ user ) should also be removed:

# userdel -r jane

The groupadd , groupmod , and groupdel commands are used in a similar way to create, modify, and delete groups.

To add a group, just specify the name as an argument to groupadd :

# groupadd groupname

The only option commonly used is -g , which lets you manually select the group ID (useful if converting data from an old system):

# groupadd -g 781 groupname

The groupmod command is rarely used, but it will change the numeric group ID ( -g ) or the name ( -n ) of an existing group:

# groupmod -g 947 groupname

# groupmod -n newname groupname

To delete a group, use groupdel :

# groupdel groupname

4.7.1.4. Managing user passwords from the command line

passwd is used to set a user's password. Used by a normal user, it sets that user's password by asking for the current password and then asking for the new password twice:

$ passwd

Changing password for user chris.

Changing password for chris

(current) UNIX password:

bigSecret

New UNIX password:

newSecret

Retype new UNIX password:

newSecret

passwd: all authentication tokens updated successfully.

When used by the root user, passwd can be used to change the root password (the default) or any existing user's password if the username is supplied as an argument. You don't need to know the current password:

# passwd

Вы читаете Fedora Linux
Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату