Prevent the user from changing his directory

Hi could some let me know how to prevent user from changing his home directory.......

Thanks in advance....

You mean, change his working directory, I suppose?

There are "restricted" versions of many shells, like rksh or rbash. They pose a set of restrictions on a user.

See Man Page for bash (linux Section 1) - The UNIX and Linux Forums for example and read the section "RESTRICTED SHELL".

As a super user I have changed a user's shell to "rbash"

After that, If i am logging through putty with tat particular usercredentials, it is not allowing me to login...

Could you please help me out in this issue....

Thanks in advance......

Maybe rbash is not present on your system yet (it isn't here either).

Just create a hard link

cd /bin
ln bash rbash

If your bash is in a different location, then create the link there.

If i just create a hard link, will it work as a restricted shell.

Is that hard link creation enough.

will it restrict particular user not to change their home directories?

Sorry to ask you so many doubts.

Thank u very much for your responses.

You may also have to add /bin/rbash (or whatever) into /etc/shells so that all the administrative commands will work and SSH login is accepted.

Robin
Liverpool/Blackburn
UK

It should work, because the shell checks the name under which it was started and if the filename starts with "r", it behaves as restricted.