Linux – RBASH how to prevent users exiting to normal bash

bashbashrclinuxrhel6

I have set up some test account to beta implement rbash to limit users from doing to much on the server. Currently I am using .bash_profile to set bash -r for these profiles. But when a user types exit they drop into the normal bash shell.

I would like to make it so when they type exit to logoff the server. Otherwise bash -r won't help restrict that access.

Please let me know any thought you have.

Best Answer

Set the users' login shell to rbash via the -s option of useradd or usermod, eg.

usermod -s /bin/rbash luser

if your rbash executable is at /bin/rbash.