Prevent the user from changing his directory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Prevent the user from changing his directory
# 1  
Old 06-24-2013
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....
# 2  
Old 06-24-2013
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".

Last edited by hergp; 06-24-2013 at 03:19 AM.. Reason: corrected typos
# 3  
Old 06-26-2013
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......
# 4  
Old 06-26-2013
Maybe rbash is not present on your system yet (it isn't here either).

Just create a hard link

Code:
cd /bin
ln bash rbash

If your bash is in a different location, then create the link there.
# 5  
Old 06-26-2013
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.
# 6  
Old 06-26-2013
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
# 7  
Old 06-26-2013
Quote:
Originally Posted by rahul547
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?
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Prevent user from creating new user from his login

Hi Experts, Need your support Redhat 6.5 I want to create a user with all(read, write, execute) privileges except that user should not be able to create any new user from his login to perform any task. (10 Replies)
Discussion started by: as7951
10 Replies

2. AIX

Prevent admin user accidentally remove database files.

Hi Folks, Any system admin did provide AIX file system control to prevent user/ admin accidentally remove database files ? Thanks. (4 Replies)
Discussion started by: ckwan
4 Replies

3. Shell Programming and Scripting

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.... (1 Reply)
Discussion started by: Revanth547
1 Replies

4. Solaris

User's Home directory ownership is changing Automatically

Hi , on my Solaris 10 machine user's home directory ownership is being changed automatically to their UID. can any one please tell me whats the reason behind it . users are there in /etc/passwd file . /etc/shadow file is also there along with nssswitch.conf file and there is no changes made to... (5 Replies)
Discussion started by: usernew
5 Replies

5. HP-UX

Changing the default login directory of a user

I want to change the default login directory of a user from /home/user to a new directory. how can i do this? thanks in advance....:) (1 Reply)
Discussion started by: smahe23
1 Replies

6. IP Networking

how to prevent a user from downloading on lan

hi all, i want to prevent users downloading files in the office as bandwidth becomes very low and affects work. one of my friend tried to close the connection using ethercap but this does not work. i have a debian desktop while other users use MS W!ndows. Please provide any help. Thanks (5 Replies)
Discussion started by: coolatt
5 Replies

7. UNIX for Dummies Questions & Answers

Force user to use ssh/prevent telnet access

I have just set up a user on our system HP-Thru64. The user needs to be able to su to root after they login and this works fine. Users cannot login from root externally so you have to first connect as a user and then su. I am wondering is it possible for me to prevent the user from having telnet... (4 Replies)
Discussion started by: peragin
4 Replies

8. Cybersecurity

prevent user from excute command

Dears I want to prevent users from doing spesific command "history -c" or "history" in general How can I do ? (4 Replies)
Discussion started by: reaky
4 Replies

9. UNIX for Advanced & Expert Users

How to prevent local root from su to an NIS user?

We have a shared development box, running Solaris 10 that is an NIS client, all the developers have local root password. If they know the NIS uid of another user, they can just do % useradd -u <uid> login And then log in as that user and have full access to his files in his home directory. ... (3 Replies)
Discussion started by: nfw
3 Replies

10. UNIX for Dummies Questions & Answers

Can I prevent a user from changing the permissions on their home directory.

Hello All, I have a new HPUX system going into production and it will be used by 2 projects. One of the contract requirements is the 2 groups can not have access to the others work or data. I believe I have the system pretty well locked up using groups and permissions and selective mounting of... (2 Replies)
Discussion started by: DanL
2 Replies
Login or Register to Ask a Question