LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 03-04-2005, 03:22 PM   #1
bluenix
LQ Newbie
 
Registered: Mar 2005
Posts: 15

Rep: Reputation: 0
Users can only see home directory


Hi,

On my Fedora system, I want users to be only able to see their home directory and all the subfolders.
Right now, when I add a new user using "useradd", they can all see the content in every directory, even the "/".
What can I do to achieve this?
 
Old 03-04-2005, 03:44 PM   #2
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 117Reputation: 117
You'll need to use a chroot in order to achieve this.

Note, however, if they are in a chroot, they need a copy of EVERY program, even things like /bin/ls, that they will want to run, in their home directory (i.e., /home/USERNAME/bin). This can be accomplished, I think, by using hardlinks to the real files. Of course, that would only work if /home and /bin reside on the same partition. Most likely, you'll need to make full copies (or explore alternatives, like using busybox, and creating a /home/bin to which you can make hardlinks for each user).
 
Old 03-09-2005, 04:32 AM   #3
or1onas
Member
 
Registered: Mar 2004
Location: Athens,Greece
Distribution: Debian,Ubuntu
Posts: 181

Rep: Reputation: 31
One question about chroot:
I've managed to create a chrooted env for a user that i need in order to connect through ssh
so i copied all the needed files and created a second 'virtual hierarchy'.
The thing is:
When i connect through an ssh client, the hierarchy has:

/
|--bin
|
|--dev
|
|--home
|
|--lib
|
|--usr

Is there some way to make all the folders except home invisible?
 
Old 03-09-2005, 10:09 AM   #4
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 13.1 / 12.3_64-KDE, Ubuntu 14.04, Fedora 20, Mint 17, Chakra
Posts: 3,644

Rep: Reputation: Disabled
Um, I simply would have removed the read flags of the directories for group users except on home and below...
 
Old 03-09-2005, 10:14 AM   #5
DaFrawg
LQ Newbie
 
Registered: Jun 2004
Location: The Netherlands
Distribution: Slackware 10.1, Debian Sarge
Posts: 28

Rep: Reputation: 15
Are you able to run things when you can't see them? In other words, can one run /bin/ls when one doesn't have the permission to read the folder /bin?
 
Old 03-09-2005, 10:16 AM   #6
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 13.1 / 12.3_64-KDE, Ubuntu 14.04, Fedora 20, Mint 17, Chakra
Posts: 3,644

Rep: Reputation: Disabled
Should be possible, there's the executeable flag as well. Why don't you try? (I'm sitting at a Windows box right now ... ).
 
Old 03-09-2005, 11:15 AM   #7
or1onas
Member
 
Registered: Mar 2004
Location: Athens,Greece
Distribution: Debian,Ubuntu
Posts: 181

Rep: Reputation: 31
i thought you'd say that, so i've already tried but it seems that DaFrawg is right.
When i chmod o-r, nothing works...
 
Old 03-09-2005, 04:54 PM   #8
Lakefall
LQ Newbie
 
Registered: Feb 2005
Location: Finland
Distribution: Debian sarge
Posts: 26

Rep: Reputation: 15
You removed the read permission from all the executables, didn't you? That doesn't work. Try removing it from directories only.
Code:
chmod o-r `find / -type d`
I have no idea what kind of problems this might cause. Should be interesting.
 
Old 03-09-2005, 04:59 PM   #9
Lakefall
LQ Newbie
 
Registered: Feb 2005
Location: Finland
Distribution: Debian sarge
Posts: 26

Rep: Reputation: 15
The previous command might not work.
Code:
find / -type d -print0 | xargs -0 chmod o-r
This should be better.
 
Old 03-10-2005, 02:18 AM   #10
or1onas
Member
 
Registered: Mar 2004
Location: Athens,Greece
Distribution: Debian,Ubuntu
Posts: 181

Rep: Reputation: 31
i'll try that later and i'll tell you if it works...
btw, i did 'chmod o-r' for /usr,/bin,/dev,/lib.
Does that make a recursive change on the files too?
 
Old 03-10-2005, 02:43 AM   #11
or1onas
Member
 
Registered: Mar 2004
Location: Athens,Greece
Distribution: Debian,Ubuntu
Posts: 181

Rep: Reputation: 31
it seems i made some mistake yesterday.
i just chmoded the folders and now the user is not able to open them.
the only thing that remains now is to make them invisible...any ideas?
 
Old 03-10-2005, 02:47 AM   #12
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 13.1 / 12.3_64-KDE, Ubuntu 14.04, Fedora 20, Mint 17, Chakra
Posts: 3,644

Rep: Reputation: Disabled
Did you also chmod / ?
 
Old 03-10-2005, 02:56 AM   #13
or1onas
Member
 
Registered: Mar 2004
Location: Athens,Greece
Distribution: Debian,Ubuntu
Posts: 181

Rep: Reputation: 31
Talking

Quote:
Originally posted by JZL240I-U
Did you also chmod / ?
that was it! thank you all guys for helping me out!
 
Old 03-10-2005, 12:05 PM   #14
Lakefall
LQ Newbie
 
Registered: Feb 2005
Location: Finland
Distribution: Debian sarge
Posts: 26

Rep: Reputation: 15
Quote:
Originally posted by or1onas
i'll try that later and i'll tell you if it works...
btw, i did 'chmod o-r' for /usr,/bin,/dev,/lib.
Does that make a recursive change on the files too?
Not unless you did "chmod -R o-r [directory]".

I don't know if it matters, but I think you still have the subdirectories in /usr etc. listable as long as a user can guess their names (which shouldn't be too difficult for the standard directories). Why are you doing this anyhow?
 
Old 03-10-2005, 01:49 PM   #15
or1onas
Member
 
Registered: Mar 2004
Location: Athens,Greece
Distribution: Debian,Ubuntu
Posts: 181

Rep: Reputation: 31
You're right about the directories being listable if guessed (which is not to difficult of course), but no dir listing access is given to them to by chmod -r.
So the user can only get inside his home folder and try to cd to /bin,/lib,etc but he gets a permission denied if he tries to do an ls...
I've already said that i set up an ssh server for sftp and i created a chrooted environment for security reasons...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Limit Users Home Directory Size KrGAce Linux - Newbie 6 10-24-2005 09:48 AM
Users home directory. Permissions. jsbush Linux - Newbie 4 10-29-2003 08:13 AM
multi users on the same home directory rpinatel Linux - General 2 09-05-2003 11:55 AM
multi users on the same home directory rpinatel Linux - General 4 09-05-2003 10:22 AM
2 users, 1 mailbox and 1 home directory keevitaja Linux - Newbie 3 08-15-2002 08:20 PM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration