Modifying Accounts


Occasionally, a user needs more done to an account than just a resetting of the password. You may need to change the groups that user is in, or the drive that a home directory resides on. The following sections explain how to modify user accounts using one of two methods: usermod or the User Manager window.

Modifying user accounts with usermod

The usermod command is similar to the useradd command and even shares some of the same options. However, instead of adding new accounts, it enables you to change various details of existing accounts. When invoking the usermod command, you must provide account details to change followed by the login name of the account. Table 11-3 lists the available options for the usermod command.

Table 11-3: usermod Options for Changing Existing Accounts

Options

Description

-c "comment"

Change the description field of the account. You can also use the chfn command for this. Replace comment with a name or other description of the user account. Since the comment can contain multiple words, the quotes are necessary.

-d home_dir

Change the home directory of the account to the specified new location. If the -m option is included, copy the contents of the home directory as well. Replace home_dir with the full path to the new directory.

-e expire_date

Assign a new expiration date for the account, replacing expire_date with a date in MM/DD/YYYY format.

-f inactivity

Set the number of days after a password expires until the account is permanently disabled. Setting inactivity to 0 disables the account immediately after the password has expired. Setting it to -1 disables the option, which is the default behavior.

-g group

Change the primary group (as listed in the /etc/group file) that the user is in. Replace group with the name of the new group.

-G grouplist

Set the list of groups that user belongs to. Replace grouplist with a list of groups.

-l login_name

Change the login name of the account to the name supplied after the -l option. Replace login_name with the new name. This does not automatically change the name of the home directory; use the -d and -m options for that.

-m

This option is used only in conjunction with the -d option. It causes the contents of the user’s home directory to be copied to the new directory.

-o

This option is used only in conjunction with the -u option. It removes the restriction that user IDs must be unique.

-s shell

Specify a new command shell to use with this account. Replace shell with the full path to the new shell.

-u user_id

Change the user ID number for the account. Replace user_id with the new user ID number. Unless the -o option is used, the ID number must not be in use by another account.

Assume that a new employee named Jenny Barnes will be taking over Mary’s job. We want to convert the mary account to a new name (-l jenny), new comment (-c "Jenny Barnes"), and home directory (-d /home/jenny). We could do that with the following command:

# usermod -l jenny -c "Jenny Barnes" -m -d /home/jenny mary 

Furthermore, if after converting the account we learn that Jenny prefers the tcsh shell, we could make that change with the -s option (-s /bin/tcsh):

 # usermod -s /bin/tcsh jenny  

Instead, we could use the chsh command to change the shell. The following is an example:

# chsh -s /bin/tcsh jenny 

The chsh command is handy because it enables a user to change his or her own shell setting. Simply leave the user name parameter off when invoking the command, and chsh assumes the currently logged-in user as the account to change.

Modifying user accounts with User Manager

To use the desktop to change an existing account, you can use the User Manager. Here’s how to add a new user from the User Manager window:

  1. From the red hat menu, select System Settings ® Users and Groups (or type system-config-users from a Terminal window as root user). The main User Manager window appears.

  2. Select the user name of the account you want to modify, then click the Properties button to open the User Properties window (see Figure 11-3).

    image from book
    Figure 11-3: Choose Properties to modify an existing user account.

  3. There are four tabs of information you can modify for the user you selected:

    • User Data — This tab contains the user information you created when you first added the user account.

    • Account Info — Select the Enable Account Expiration check box, then type a date if you want the account to become inaccessible after a particular date. Select the Local Password is Locked check box if you want to prevent access to the account but not delete it. (The latter is a good technique when an employee is leaving the company or if you want to lock out a customer whose account is temporarily disabled. The information isn’t removed, it just isn’t accessible.)

    • Password Info — Select Enable Password Expiration if you want to control expiration of the user’s password. By default, passwords don’t expire. Here are your options: “Days before change allowed” (forces the user to keep the password for at least a set number of days before it can be changed); “Days before change required” (allows the user to keep the same password for at least the set number of days); “Days warning before change” (sets how many days before the password expiration day that the user is warned to change the password); “Days before account inactive” (sets the number of days after which the account is deactivated).

    • Groups — Select from the list of available groups to add the user to one or more of those groups.

  4. Click OK to apply the changes to the user account.




Red Hat Fedora Linux 3 Bible
Red Hat Fedora Linux 3 Bible
ISBN: 0764578723
EAN: 2147483647
Year: 2005
Pages: 286

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net