Use Bash on a Non Bash User

From Brian Nelson Ramblings
Revision as of 14:44, 14 March 2014 by Brian (Talk | contribs) (List of available shells on your machine)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Using Bash on an Account without Bash

Have you ever tried to use bash on an account that does not have bash setup on it, example apache.

When trying to SuperUser into apache, you will get the error "This account is Currently no Available"

Now you can always just change that user and give them /bin/bash

chsh -s /bin/bash apache

But that is not really what you want to do, unless that account needs bash access.

To use that account with bash without changing the account you can also su into the user.

su {useraccount} -s /bin/bash

You will become that user even though they do not have bash access.

How to check the shell on Users

You will want to check out the /etc/passwd file.

You would be looking for users with /bin/false or /bin/nologin or /usr/sbin/nologin

userdude:x:111:113::/home/userdude:/bin/false
userdude:x:111:113::/home/userdude:/bin/nologin
userdude:x:111:113::/home/userdude:/usr/sbin/nologin

List of available shells on your machine

To see a list of the available shells on your machine, you can take a look at the /etc/shells file

$ cat /etc/shells
# /etc/shells: valid login shells
/bin/csh
/bin/sh
/usr/bin/es
/usr/bin/ksh
/bin/ksh
/usr/bin/rc
/usr/bin/tcsh
/bin/tcsh
/usr/bin/esh
/bin/dash
/bin/bash
/bin/rbash
/usr/bin/screen
/bin/zsh
/usr/bin/zsh