Next | Prev | Up | Top | Contents | Index

Changing User Information

This section covers the following procedures:

This section tells you how to change the values for an individual user's login information. You cannot use these commands for a login you installed as an NIS-type entry. If the login account is an NIS type, you must change the master password file on the network server. See the chapter ''The Network Information Service (NIS)'' in the NFS User's Guide for more information about NIS.


Changing a User's Login Name

To change a user's login name, perform the following steps:

  1. Edit the /etc/passwd file and change the entry for the user's login to reflect the new login name. For example, to change the login name cramden to ralph, find the line:

    cramden:x:103:101:Ralph Cramden:/usr/people/cramden:/bin/csh

    Change the name field and the default directory field as follows:

    ralph:x:103:101:Ralph Cramden:/usr/people/ralph:/bin/csh

    For consistency's sake, the home directory should always have the same name as the user account. If your system has shadow passwords enabled, you will see the character ''x'' in place of the encoded password in the user's entry. For more information on shadow passwords, see the IRIX Admin: Backup, Security, and Accounting guide.

    When you save and exit the file, you may see an error message that the file is ''read-only'' or that write permission is denied. This is a protection that IRIX puts on the /etc/passwd file. Use the command:

    :w!

    in the vi(1) editor to override this protection. If you are using jot(1), the file can be saved with no difficulty. For complete information on the commands available in vi(1), see the vi(1) reference page.

  2. If your system has shadow passwords enabled, edit the /etc/shadow file next. Look for the line that begins with the user name you wish to change. In this example, the line would look like this:

    cramden:XmlGDVKQYet5c:::::::

    Change the name in the entry to ''ralph'' as follows:

    ralph:XmlGDVKQYet5c:::::::

    When you have made the change, save and exit the file. As with /etc/passwd, if you are using vi(1), you may encounter an error message.

  3. Go to the directory that contains the user's home directory and change the name of the home directory to match the user's new login name. Use the command:

    mv cramden ralph

  4. Since IRIX identifies the files owned by the user ''cramden'' by the user ID number, rather than by the login name, there should be no need to change the ownership.

Changing a User's Password

Occasionally, a user forgets his or her password. To solve the problem, you must assign that user a temporary password, then have the user change the temporary password to something else. This is because there is no easy way to guess a forgotten password.

To assign a new password, perform these steps:

  1. Log in as root.

  2. Use the passwd command to change the password for the user's account.

    For example, if the user ralph forgets his password, enter:

    passwd ralph

  3. Follow the screen prompts: (The password entered is not echoed.)

    New password: 2themoon

    Re-enter new password: 2themoon

    Because you are logged in as the superuser (root), you are not prompted for an old password.

The user's password is now changed to ''2themoon.'' The user should immediately change the password to something else.


Changing a User's Login ID Number

It is not recommended to change user login ID numbers. These numbers are crucial in maintaining ownership information and responsibility for files and processes. However, if for some reason you must change a user's login ID number, perform the following steps:

  1. Make a complete backup tape of the user's home directory and any working directories he or she may have on the system.

  2. Lock the user's account by placing a number sign (#) at the beginning of the line, and an asterisk (*) in the password field of the /etc/passwd file. Do not delete the entry, as you will want to keep it as a record that the old user ID number was used and should not be reused. When you are finished, the entry should look like this:

    # ralph:*:103:101:Ralph Cramden:/usr/people/ralph:/bin/csh

  3. Completely remove the user's home directory, all subdirectories, and any working directories the user may have.

  4. Use the following command from your system's root directory to find any other files the user may own on the system and display the filenames on the console:

    find . -user name -print

    Archive and remove any files that are found.

  5. Create a new user account using the instructions provided in this chapter. It may have the same name as the old account, but it is better to change names at the same time, to avoid confusion. Use the new user ID number.

  6. Restore the home directory, working directories, and any other files you located from the backup you made. If necessary, use the chown(1) and chgrp(1) commands to set the new user ID correctly.

Changing a User's Default Group

A user can be a member of many different groups on your system, but only one group is the default group. This is the group that the user begins with at login time. To change the default group at login time, simply edit the /etc/passwd file and find the appropriate line. For example:

cramden:+:103:101:Ralph Cramden:/usr/people/cramden:/bin/csh

To change the default group from 101 to 105, simply change the field in the passwd file entry as follows:

cramden:+:103:105:Ralph Cramden:/usr/people/cramden:/bin/csh

Be certain before you make any change, however, that group 105 is a valid group in your /etc/groups file and that the user is a member of the group. For more information on creating groups, see "Adding User Groups Using Shell Commands".


Changing a User's Comments Field

There is a field in each entry in /etc/passwd for comments about the user account. This field typically contains the user's name and possibly his or her telephone number or desk location. To change this information, simply edit the /etc/passwd file and change the information. Note only that you cannot use colon (:) within the comments, since IRIX will interpret these as ending the comments field. For example, consider this entry:

cramden:x:103:101:Ralph Crumdin:/usr/people/cramden:/bin/csh

It would not be long before Ralph came to the administrator and requested to have the misspelling of his name corrected. In this case, you would change the line to read:

cramden:x:103:101:Ralph Cramden:/usr/people/cramden:/bin/csh


Changing a User's Default Home Directory

The next field in an /etc/passwd entry specifies the user's home directory. This is the directory that the user is placed in at login time, and the directory that is entered in the shell variable $HOME. For complete information on shell variables, see the reference pages for the shell you are using (typically csh(1), sh(1), tcsh(1), or ksh(1)). Home directories are typically placed in /usr/people, but there is no reason why you cannot select another directory. Some administrators select a different directory to preserve file system space on the /usr file system, or simply because the users have a strong preference for another directory name. In any case, the procedure for changing the home directory of a user is quite simple. Follow these steps:

  1. Log in as root.

  2. Edit the /etc/passwd file and look for the user entry you wish to change. For example:

    cramden:x:103:101:Ralph Cramden:/usr/people/cramden:/bin/csh

    In this example, the home directory is /usr/people/cramden. If you wish to change the home directory to a recently added file system called disk2, change the entry to read:

    cramden:x:103:101:Ralph Cramden:/disk2/cramden:/bin/csh

    When you have made your changes, write and exit the file.

  3. Create the directory in the new file system and move all of the files and subdirectories to their new locations. When this is done, remove the old home directory and the process is finished.

  4. Be sure that you notify your users well in advance if you plan to change their home directories. Most users have personal aliases and programs that may depend on the location of their home directory. As with all major changes to your system's layout, changing home directories should not be done for trivial reasons, as it can cause serious inconvenience to your users.

Changing a User's Default Shell

To change the default shell, follow these steps:

  1. Log in as root.

  2. Edit the /etc/passwd file and change the field that names the user's default shell. For example, in the passwd entry:

    ralph:x:103:101:Ralph Cramden:/usr/people/ralph:/bin/csh

    The default shell is /bin/csh. To change the user's default shell, change the field in the passwd entry to the desired program. For example, to change Ralph's shell to /bin/sh, edit the line to look like this:

    ralph:x:103:101:Ralph Cramden:/usr/bin/ralph:/bin/sh

  3. Save and exit the /etc/passwd file. When the user next logs in, the new default shell will be used.

  4. Note that you can use any executable program as the default shell. IRIX simply executes the given program when a user logs in. Note also that using a program other than a command shell such as csh or sh can cause problems for the user. When the program identified as the default shell in the passwd file exits, the user is logged out. Therefore, if you use /bin/mail as the default shell, when the user exits mail, he or she will be logged out and will not be able to perform any other work.

Next | Prev | Up | Top | Contents | Index