Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent from changing directory

Status
Not open for further replies.

sureshp

Programmer
Aug 28, 2000
79
0
0
Hi all,
I have a simple doubt in changing directory(cd).
Suppose If I have 50 users , as their home directory is /myproj/** (**- one to fifty).The first user should not
change directory to any other user like this.
Suppose if firsr user logsin he will be in /myproj/1
He should not go /myproj/2 by typing the command
cd ../2 or cd .. & cd 2

Thanks.

 
Just make sure that the permissions on the home directories are "drwx------". You can do this by running, for example, "chmod 700 /home/1". Once you have done this, only the owner of the directory can access it.

Another alternative may be to set the user's login shell to be rsh. Although this shell has the same program name as the remote shell (aka rsh), it is actually the "restricted shell". It usually lives at /usr/lib/rsh. When using rsh, a user may not update $PATH; they cannot use the cd command; they can't specify command names containing the "/" character; and they can't redirect output using ">" and ">>".

The restrictions take effect after .profile has been executed, so $PATH may be updated by the user if they can update their .profile. Here's an excerpt from the man page on one of my servers that may help explain this further:
Code:
          When a command to be executed is found to be a shell                  
          procedure, /usr/lib/rsh invokes sh to execute it.  Thus, it           
          is possible to provide to the end-user shell procedures that          
          have access to the full power of the standard shell, while            
          imposing a limited menu of commands; this scheme assumes              
          that the end-user does not have write and execute                     
          permissions in the same directory.                                    
                                                                                
          The net effect of these rules is that the writer of the (see          
          profile(4)) has complete control over user actions by                 
          performing guaranteed setup actions and leaving the user in           
          an appropriate directory (probably not the login directory).          
                                                                                
          The system administrator often sets up a directory of                 
          commands (for example, /usr/rbin) that can be safely invoked          
          by a restricted shell.  Some systems also provide a                   
          restricted editor, red.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top