Operating System - Linux
1753905 Members
10123 Online
108810 Solutions
New Discussion юеВ

How to restrict a user from perform "cd" command on RedHat

 
SOLVED
Go to solution

How to restrict a user from perform "cd" command on RedHat

Customer is trying to restrict a determined user to move from the /home directory, if the bash -r line is added to the .bash_profile it works, however if the user types "exit" once, it returns to the normal bash shell with no restrictions,any suggestion?
4 REPLIES 4
Ivan Ferreira
Honored Contributor
Solution

Re: How to restrict a user from perform "cd" command on RedHat

Two options:

1- Add an exit below the bash -r in the profile.

bash -r
exit

So, when the user type exit, exit is runned again. But this is not good if you put in the .bash_profile, because the users have control over this file and can be changed.

2- Recommended

Create a symbolic link to the bash file and name it rbash, configure the user to use this file as shell:

cd /etc/security
ln -s /bin/bash rbash
usermod -s /etc/security/rbash username
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?

Re: How to restrict a user from perform "cd" command on RedHat

It works !!! i tried both options and they worked, thanks a lot for your help :-)
Regards.
Ivan Ferreira
Honored Contributor

Re: How to restrict a user from perform "cd" command on RedHat

Good, please see also:

http://forums1.itrc.hp.com/service/forums/helptips.do?#28

Take a little time to assign points to your questions, this is a good way to thank in the forum:

http://forums1.itrc.hp.com/service/forums/pageList.do?userId=CA640287&listType=question&forumId=1
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Steven E. Protter
Exalted Contributor

Re: How to restrict a user from perform "cd" command on RedHat

Roberto,

Please say thanks to Ivan with points.

Please read this:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=140137

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com