Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

chsh

From Wikipedia, the free encyclopedia
Command on Unix-like operating systems
For the theorem in quantum mechanics, seeCHSH inequality.
chsh
Original authorSalvatore Valente
Operating systemUnix andUnix-like
TypeCommand

chsh (an abbreviation of "change shell") is acommand onUnix-likeoperating systems that is used to change a loginshell. Users can either supply thepathname of the shell that they wish to change to on the command line, or supply no arguments, in which casechsh allows the user to change the shell interactively.[1]

Usage

[edit]

chsh is asetuid program that modifies the/etc/passwd file, and only allows ordinary users to modify their own login shells. Thesuperuser 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 usingchsh.[1][2][3]

On most systems, whenchsh is invoked without the-s command-line option (to specify the name of the shell), it prompts the user to select one. OnMac OS X, if invoked without the-s option,chsh displays a text file in the default editor (initially set to vim) 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:". When the user quits vim, the changes made there are transferred to the /etc/passwd file which only root can change directly.[2][4]

Using the-s option (for example:%chsh-s/usr/local/bin/bash) greatly simplifies the task of changing shells.

Depending on 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 ofchsh by non-root users is disabled entirely by the sysadmin.[4]

On manyLinux distributions, thechsh command is aPAM-aware application. As such, its behaviour can be tailored, using PAM configuration options, for individual users. For example, anauth directive that specifies thepam_listfile.so module can be used to denychsh access to individual users, by specifying a file of the usernames to deny access to with thelistfile= option to that module (along with thesense=deny option).[5]

Portability

[edit]

POSIX does not describe utilities such aschsh, which are used for modifying the user's entry in/etc/passwd. Most Unix-like systems providechsh.[6]SVr4-based systems provided a similar capability withpasswd. Two of the three remaining systems (IBM AIX[7] andHP-UX[8]) providechsh in addition topasswd -e. The exception isSolaris, where non-administrators are unable to change their shell unless a network name server such asNIS orNIS+ is installed.[9][10] The obsolete[11]SGI SVr4 systemIRIX64 also lackedchsh.

See also

[edit]

References

[edit]
  1. ^abCameron Newham and Bill Rosenblatt (2005).Learning the Bash Shell: [Unix shell programming]. O'Reilly. pp. 272.ISBN 0596009658.
  2. ^abMark G. Sobell and Peter Seebach (2005).A Practical Guide To Unix For Mac Os X Users. Prentice Hall PTR. p. 448.ISBN 0131863339.
  3. ^Æleen Frisch (2002).Essential System Administration. O'Reilly. p. 238.ISBN 0596003439.
  4. ^abDeborah S. Ray and Eric J. Ray (1998).Unix. Peachpit Press. pp. 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. pp. 101–102.ISBN 0130158070.
  6. ^Nelson Beebe (August 11, 2005)."chsh command availability".
  7. ^"IBM Knowledge Center chsh command". IBM. RetrievedJanuary 24, 2015.
  8. ^"chsh(1)". Hewlett Packard. Archived fromthe original on January 28, 2015. RetrievedJanuary 24, 2015.
  9. ^Peter Smulder (March 12, 2000),chsh on Solaris, LinuxForum
  10. ^Henry van Cleef (February 4, 2005)."User chsh shell change function needed for Solaris". LinuxForum.
  11. ^"SGI - Services & Support: SGI Support of MIPS IRIX Products Continues to December 2013". Archived fromthe original on July 6, 2009. RetrievedJanuary 24, 2015.

Further reading

[edit]

External links

[edit]
The WikibookGuide to Unix has a page on the topic of:Choosing a shell
File system
Processes
User environment
Text processing
Shell builtins
Searching
Documentation
Software development
Miscellaneous
Retrieved from "https://en.wikipedia.org/w/index.php?title=Chsh&oldid=1304430616"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp