0

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.

3 Answers 3

1

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.

2
  • When I user usermod -s rbash test login dose not work. it updates the /etc/passwd file to test:x:uid:gid::home/test:rbash I need to update it back to /bin/bash to allow login. Nov 23, 2015 at 23:43
  • 1
    Try giving the correct path to rbash in the -s option. Hint: -s bash wouldn't work either. If it still doesn't work, try to provide a proper problem description. Hint: "does not work" isn't one. Nov 23, 2015 at 23:57
1

The exact answer to your question is to

exec bash -r

That will replace the login shell with rbash, not simply launch a child process..

The best answer is to change the user's login shell.

0

Here is the fix for /bin/bash not showing up then do the

sudo ln -s /bin/bash /bin/rbash
sudo bash -c ‘echo “/bin/rbash” >> /etc/shells’
sudo chsh -s /bin/rbash ruser

then do this to change the user shell

chsh -s /bin/rbash test

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .