restrict one user to see only his home directory in his profile


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers restrict one user to see only his home directory in his profile
# 1  
Old 02-05-2009
restrict one user to see only his home directory in his profile

Hi
I need to restrict one user to see only his home directory and
one more directory how i can do this in his profile.
The OS is Red hat linux

I create a user -- tec
and group calle --tec

one the user log in he will see
/home/tec

and he need to see /opt/load

this dirctory load is belong to tec group

he should not see any other directories
how i can do this in the profile

rds
# 2  
Old 02-06-2009
You need to do lots of customization. By defalut system gives you read access of most of the directories/files. You can try creating chroot like environment.

- nilesh
# 3  
Old 02-06-2009
providing you have the password shell set to ksh,
you can put this in his .profile:

Code:
cd /opt/load

_cd()
{
\cd /opt/load
}

typeset -xf _cd

alias -x cd=_cd

alias -x unalias=:

heh heh heh!!

heck, even easier:

Code:
cd /opt/load
alias -x cd=:


Last edited by quirkasaurus; 02-06-2009 at 11:44 AM..
# 4  
Old 02-07-2009
HI
It works fine but the folder under the current folder all i cannot cd:

IF there is a folder under /opt/tec/test

in my script if i add like below

cd /opt/tec
alias cd=:

this will go up to /opt/tec
it never allow me to go to test folder

but i need to go to the subdirectory under the current directory and
not to any other directory

rds
# 5  
Old 02-09-2009
Ok. Unless you change the "world" permissions on the whole system,
I don't believe that you can do this through permissions.

So.... that's why I think you need a slightly more sophisticated solution.

Try putting this in the user's ~/.profile

Then, you can put all of the valid directories in the
/.approved_dirs file
Make that file read / writable by root only, and
the directory where it resides cannot by writable
by the user. But we're assuming a rather unsophisticated user anyways.
Putting the .approved_dirs file in their HOME directory and making it
owned by root and not writeable by anyone else might be sufficient.

Code:
typeset -xf _cd



function _cd
{


\cd $*

if grep "^${PWD}$" /.approved_dirs > /dev/null 2>&1 ; then
  return
fi

\cd $OLDPWD

return
}


alias -x cd=_cd

# 6  
Old 02-25-2009
thaknks quirkasaurus
it works great , thanks for your help
# 7  
Old 02-25-2009
as an added safeguard, you may change the ownership on the .profile
to root, and the permissions on .profile and .approved_dirs to 644.

then, change the permissions on their home directory to 1755.
This will make it impossible for the user to change or remove the
.profile and the .approved dirs files.

chmod 1755 ~user

This'll make things air-tight.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to restrict ftpusers in AIX to home directory?

I need to know how to restrict the ftpusers within their home directory in AIX 7.1 For example for ftpuser nonoftp I have tried putting this entry to /etc/ftpaccess.ctl and refreshed inetd but the directory listing unsuccessful error comes with the entry. Without the ftpaccess.ctl file ftp users... (2 Replies)
Discussion started by: pregmi
2 Replies

2. AIX

How to restrict user to a particular directory?

hi, I want to restrict some user access to only 1 directory (including all sub-directories/files in it). can you please explain me, how can we do this? example; Filesystem GB blocks Used Free %Used Mounted on /dev/hd4 2.61 1.02 1.59 40% / /dev/hd2 ... (7 Replies)
Discussion started by: aaron8667
7 Replies

3. UNIX for Dummies Questions & Answers

Executing profile from any directory other than $HOME

Is there a way to run the profile which is not in $HOME directory? then whats the command for that? (1 Reply)
Discussion started by: SKhan
1 Replies

4. Solaris

Restrict FTP User to a Directory

I am using Solaris 10 on SPARC. SunOS ddw 5.10 Generic_139555-08 sun4u sparc SUNW,SPARC-Enterprise I have put some text files in a directory '/u01/network' I want to create a ftp user which can just read the files in the network directory. The ftp user shouldn't be able to navigate or see... (4 Replies)
Discussion started by: fahdmirza
4 Replies

5. Red Hat

Restrict user to a particular directory

Hi I have a Fedora10 server and i need a particular user to view files only in a particular folder. All other files in other folders having "read" permission for all shouldn't be accessible to this user. Please let me know if ther's a way. Thanks, HG (5 Replies)
Discussion started by: Hari_Ganesh
5 Replies

6. UNIX for Dummies Questions & Answers

setting home as lin in user profile

Hi. I have a directory structure built with links. For example: /home/user1 is a link to /var/123/user1 can i set the home variable in the .profile of the user to use a link? or it has to be a "real" directory? tks (1 Reply)
Discussion started by: mrodrig
1 Replies

7. UNIX for Dummies Questions & Answers

how do U restrict a user to a single directory?

specifically - I don't need to restrict a user to a single directory - but I want them to be "ROOTED" to their home directory. so if my home directory is /home/onlyme when I login - if I do a pwd - I want to see: / but in real life I will be in /home/onlyme - it just appears as root to... (10 Replies)
Discussion started by: itobenon
10 Replies

8. UNIX for Dummies Questions & Answers

Restrict user access to their home dir

Hi! i'm using FreeBSD 6.2 and hosting my pc to frens in particular of sensitive information being saved to the PC, i would like to know is it possible for me to restrict user access to their /home dir. only? and also, i wanted to restrict them listing files under /etc thanks all! (10 Replies)
Discussion started by: rdns
10 Replies

9. Solaris

need to restrict user to his home dir

Hello, i need to create a user who's access is restricted only to his home directory and below, i restricted his pty access by adding 'no-pty' to the options of the ssh key in authorized_keys file. However, sftp access still allows this user access to all my file system thanks (5 Replies)
Discussion started by: lidram
5 Replies

10. UNIX for Dummies Questions & Answers

Restrict users to ther home directory

Hello! I want users in a certain group to be restricted to their home directory. So that they have full access to all files and folders in their home directory but the cant go to any directory above. Does anyone know how to do this? Anders (1 Reply)
Discussion started by: alfabetman
1 Replies
Login or Register to Ask a Question