# all these commands will modify /etc/passwd su - root # disable login for user usermod -s /usr/sbin/nologin username # change login-shell of username to bash usermod -s /bin/bash username # change login-shell of username to sh usermod -s /bin/sh username # tested and works on debian8, suse12, centos7 usermod -s /bin/zsh username; # change login-shell of maria to zsh (needs to be installed first apt-get install zsh) # root can switch over to other users context-previliges su - username # view the currently used shell of logged-in user echo $SHELL /bin/sh
who is using what?
grep /bin/bash /etc/passwd; # output all interactive user accounts that use bash as shell
grep /bin/sh /etc/passwd; # output all interactive user accounts that use sh as shell grep /bin/false /etc/passwd; # output all service accounts that can not used to login usermod -s /bin/false maria; # change login-shell of maria to /bin/false (no login shell)
/bin/false is usually used for users who’s sole purpose it is to run a service with non-root privileges
– so it’s not possible to hack-in with them via ssh for security reasons.
manpages:
DESCRIPTION
Zsh is a UNIX command interpreter (shell) usable as an interactive login shell and as a shell script command processor. Of the standard shells, zsh most
closely resembles ksh but includes many enhancements. Zsh has command line editing, builtin spelling correction, programmable command completion, shell
functions (with autoloading), a history mechanism, and a host of other features.
bash – GNU Bourne-Again SHell
Bash is Copyright (C) 1989-2013 by the Free Software Foundation, Inc.
DESCRIPTION
Bash is an sh-compatible command language interpreter that executes commands read from the standard input or from a file. Bash also incorporates useful
features from the Korn and C shells (ksh and csh).
Bash is intended to be a conformant implementation of the Shell and Utilities portion of the IEEE POSIX specification (IEEE Standard 1003.1). Bash can
be configured to be POSIX-conformant by default.
sh – shell, the standard command language interpreter
This manual page is part of the POSIX Programmer’s Manual.
The Linux implementation of this interface may differ (consult the corresponding Linux manual
page for details of Linux behavior), or the interface may not be implemented on Linux.
The sh utility is a command language interpreter that shall execute commands read from a command line string, the standard input, or a specified file.
The application shall ensure that the commands to be executed are expressed in the language described in Shell Command Language.
Pathname expansion shall not fail due to the size of a file.
Shell input and output redirections have an implementation-defined offset maximum that is established in the open file description.
liked this article?
- only together we can create a truly free world
- plz support dwaves to keep it up & running!
- (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
- really really hate advertisement
- contribute: whenever a solution was found, blog about it for others to find!
- talk about, recommend & link to this blog and articles
- thanks to all who contribute!