Chsh

From Wikipedia, the free encyclopedia

Wikibooks
Wikibooks Guide to Unix has a page on the topic of

chsh (an abbreviation of "change shell") is a command on UNIX systems that is used to change a login shell. Users can either supply the pathname of the shell that they wish to change to on the command line, or supply no arguments, in which case chsh allows the user to change the shell interactively.[1]

chsh is a setuid program that modifies the /etc/passwd file, and only allows ordinary users to modify their own login shells. The superuser can modify the shells of other users, by supplying the name of the user whose shell is to be modified as a command-line argument. For security reasons, the shells that both ordinary users and the superuser can specify are limited by the contents of the /etc/shells file, with the pathname of the shell being required to be exactly as it appears in that file. (This security feature is alterable by re-compiling the source code for the command with a different configuration option, and thus is not necessarily enabled on all systems.) The superuser can, however, also modify the password file directly, setting any user's shell to any executable file on the system without reference to /etc/shells and without using chsh.[1][2][3]

On most systems, when chsh is invoked without the -s command-line option (to specify the name of the shell), it prompts the user to select one. On Mac OS X, if invoked without that option chsh displays an account editor allowing the user to change all of the features of their user account that they are permitted to change, the pathname of the shell being the name next to "Shell:".[2][4]

Depending from the system, chsh may or may not prompt the user for a password before changing the shell, or entering interactive mode. On some systems, use of chsh by ordinary users is disabled entirely.[4]

On many Linux distributions, the chsh command is a PAM-aware application. As such, its behaviour can be tailored, using PAM configuration options, for individual users. For example, an auth directive that specifies the pam_listfile.so module can be used to deny chsh access to individual users, by specifying a file of the usernames to deny access to with the listfile= option to that module (along with the sense=deny option).[5]

Contents

[edit] References

  1. ^ a b Cameron Newham and Bill Rosenblatt (2005). Learning the Bash Shell: [Unix shell programming]. O'Reilly, 272. ISBN 0596009658. 
  2. ^ a b Mark G. Sobell and Peter Seebach (2005). A Practical Guide To Unix For Mac Os X Users. Prentice Hall PTR, 448. ISBN 0131863339. 
  3. ^ Æleen Frisch (2002). Essential System Administration. O'Reilly, 238. ISBN 0596003439. 
  4. ^ a b Deborah S. Ray and Eric J. Ray (1998). Unix. Peachpit Press, 47. ISBN 0201353954. 
  5. ^ Scott Mann and Ellen L. Mitchell (2000). Linux System Security: The Administrator's Guide to Open Source Security Tools. Prentice Hall PTR, 101–102. ISBN 0130158070. 

[edit] Further reading

  • Cynthia Gibas and Per Jambeck (2001). Developing Bioinformatics Computer Skills. O'Reilly, 89–90. ISBN 1565926641.  — some examples of invoking chsh with the -s and -l options

[edit] See also

[edit] External links

Languages