[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 1

chsh Command

Purpose

Changes a user's login shell.

Syntax

chsh [ -R load_module ] [ Name  [ Shell ] ]

Description

The chsh command changes a user's login shell attribute. The shell attribute defines the initial program that runs after a user logs in to the system. This attribute is specified in the /etc/passwd file. By default, the chsh command changes the login shell for the user who gives the command.

The chsh command is interactive. When you run the chsh command, the system displays a list of the available shells and the current value of the shell attribute. Then, the system prompts you to change the shell. You must enter the full path name of an available shell.

If you have execute permission for the chuser command, you can change the login shell for another user. To change the login shell for another user, specify a Name parameter. Valid shells are defined in the usw stanza of the /etc/security/login.cfg file. The default list of valid shells is: /usr/bin/ksh, /usr/bin/sh, /usr/bin/bsh, /usr/bin/csh but your system manager may have defined more.

For users that are created with an alternate Identification and Authentication (I&A) mechanism, the -R flag can be used to specify the I&A load module used to create the user. Load modules are defined in the /usr/lib/security/methods.cfg file.

Flag

-R load_module Specifies the loadable I&A module used to change the user's shell.

Security

Access Control: All users should have execute (x) access to this command since the program enforces its own access policy. This command should be installed as a program in the trusted computing base (TCB). The command should be owned by the security group with the setgid (SGID) bit set.

Files Accessed:

Mode File
x /usr/bin/chuser
r /etc/security/login.cfg
rw /etc/passwd

Limitations

Changing a user's shell may not be supported by all loadable I&A modules. If the loadable I&A module does not support changing a user's shell, an error is reported.

Examples

  1. To change the shell that runs after you log in to the system, type:

    chsh

    Information similar to the following appears:

    current available shells:
     /usr/bin/sh
     /usr/bin/bsh
     /usr/bin/csh
     /usr/bin/ksh:
    current login shell:
     /usr/bin/ksh
    change (y/n)? >

    Indicate that a change should be made by entering y after the change (y/n)? prompt. Then, add the name of the shell you want when the to? prompt appears, as in the following example:

    change (y/n)? > y
    to? > /usr/bin/csh

    The next time you log in, the /usr/bin/csh shell appears.

  2. To change the shell to /usr/bin/ksh for kim, type:

    chsh kim /usr/bin/ksh
  3. To change the shell for LDAP I&A load module defined user davis, type:

    chsh -R LDAP davis

Files

/usr/bin/chsh Specifies the path to the chsh command.
/usr/bin/chuser Changes user information.
/etc/passwd Contains the basic user attributes.
/etc/security/login.cfg Contains login configuration information.

Related Information

The chgroup command, chgrpmem command, chuser command, lsgroup command, lsuser command, mkgroup command, mkuser command, passwd command, pwdadm command, rmgroup command, rmuser command, setgroups command, setsenv command.

Security Administration in AIX 5L Version 5.2 System Management Concepts: Operating System and Devices describes the identification and authentication of users, discretionary access control, the trusted computing base, and auditing.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]