LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   restrict user to home directory at logon (https://www.linuxquestions.org/questions/linux-security-4/restrict-user-to-home-directory-at-logon-150691/)

pragti 02-26-2004 07:31 AM

restrict user to home directory at logon
 
Hi
Can we restrict user to his home directory only in (redhat linux7.2) .So that user can browse only files in his directory.

Rounan 02-26-2004 08:29 AM

Remove read, write and execute permissions for generic users from everywhere else:
chmod o-rwx <everything else>

Particularly, make sure no folders have execute permissions - this will present users browsing them.
You can then set group permissions and add users to groups as appropriate.

--Rounan

pragti 02-26-2004 08:32 AM

i want that the particular user cannot even browse the /tmp folder (where the permission by default are 1777)

More so (Remove read, write and execute permissions for generic users from everywhere else:
chmod o-rwx <everything else>) doing this will make my many other process unworthy

Rounan 02-26-2004 09:10 AM

Well, as roundabout as it seems, so far as I know, permissions are positive-based and not negative-based. I'm a relative newbie and might be entirely wrong, but I don't know of a way to remove permissions from one specific user other than removing them, entirely, and then granting them to users you DO want to have them.

Quote:

i want that the particular user cannot even browse the /tmp folder (where the permission by default are 1777)
so chmod o-rwx /tmp

Quote:

More so (Remove read, write and execute permissions for generic users from everywhere else:
chmod o-rwx <everything else> ) doing this will make my many other process unworthy
I don't know what you mean by "unworthy", but it won't affect anything at all if you manage your groups properly. Add the users you want to have permissions in certain areas to the group that owns that directory/file, and the users shouldn't even notice the permissions change.

I agree that it seems like a pretty inelegant workaround jsut to lock out one user, but it will work and it will result in a more secure system overall.

--Rounan

comp12345 02-27-2004 03:00 AM

You have to create a chroot environment(jail) for the user. There is a tutorial which you can find here: http://tjw.org/chroot-login-HOWTO/

iainr 02-27-2004 03:16 AM

Quote:

Originally posted by Rounan
Remove read, write and execute permissions for generic users from everywhere else:
chmod o-rwx <everything else>

Particularly, make sure no folders have execute permissions - this will present users browsing them.
You can then set group permissions and add users to groups as appropriate.

--Rounan

I'm afraid that one isn't going to work (hence the need for a chroot environment as comp12345 said).

For example, when you type the command "ls", it looks at the directories in your PATH variable for an executable file called ls, then executes it. If you don't have execute permission on the directory that contains ls, you can't see it so you can't run the command.

In fact, if you do chmod o-rwx you won't even be able to log on as that user.

Creating a chroot environment has the same effect, but you get round this problem by providing local copies of commands you want the user to be able to run, as well as local versions of configuration files they need (e.g. /etc/passwd).

Rounan 02-27-2004 08:00 AM

...true. Hadn't thought of that. ;)

Thanks for clearing that up.

Yarrrrr.... I'm not a sysadmin. ;)

--Rounan


All times are GMT -5. The time now is 08:01 AM.