RBASH how to prevent users exiting to normal bash?

Posted on

RBASH how to prevent users exiting to normal bash? – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about linux, bash, rhel6, bashrc, .

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.

Solution :

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.

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.

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

Leave a Reply

Your email address will not be published. Required fields are marked *