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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
03-04-2005, 03:22 PM
|
#1
|
|
LQ Newbie
Registered: Mar 2005
Posts: 15
Rep:
|
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?
|
|
|
|
03-04-2005, 03:44 PM
|
#2
|
|
Moderator
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,505
Rep: 
|
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).
|
|
|
|
03-09-2005, 04:32 AM
|
#3
|
|
Member
Registered: Mar 2004
Location: Athens,Greece
Distribution: Debian,Ubuntu
Posts: 181
Rep:
|
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?
|
|
|
|
03-09-2005, 10:09 AM
|
#4
|
|
Senior Member
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 12.3_64-KDE, Ubuntu 12.04, Fedora 17, Mint 14, Chakra
Posts: 3,516
Rep: 
|
Um, I simply would have removed the read flags of the directories for group users except on home and below...
|
|
|
|
03-09-2005, 10:14 AM
|
#5
|
|
LQ Newbie
Registered: Jun 2004
Location: The Netherlands
Distribution: Slackware 10.1, Debian Sarge
Posts: 28
Rep:
|
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?
|
|
|
|
03-09-2005, 10:16 AM
|
#6
|
|
Senior Member
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 12.3_64-KDE, Ubuntu 12.04, Fedora 17, Mint 14, Chakra
Posts: 3,516
Rep: 
|
Should be possible, there's the executeable flag as well. Why don't you try? (I'm sitting at a Windows box right now ...  ).
|
|
|
|
03-09-2005, 11:15 AM
|
#7
|
|
Member
Registered: Mar 2004
Location: Athens,Greece
Distribution: Debian,Ubuntu
Posts: 181
Rep:
|
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...
|
|
|
|
03-09-2005, 04:54 PM
|
#8
|
|
LQ Newbie
Registered: Feb 2005
Location: Finland
Distribution: Debian sarge
Posts: 26
Rep:
|
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. 
|
|
|
|
03-09-2005, 04:59 PM
|
#9
|
|
LQ Newbie
Registered: Feb 2005
Location: Finland
Distribution: Debian sarge
Posts: 26
Rep:
|
The previous command might not work.
Code:
find / -type d -print0 | xargs -0 chmod o-r
This should be better.
|
|
|
|
03-10-2005, 02:18 AM
|
#10
|
|
Member
Registered: Mar 2004
Location: Athens,Greece
Distribution: Debian,Ubuntu
Posts: 181
Rep:
|
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?
|
|
|
|
03-10-2005, 02:43 AM
|
#11
|
|
Member
Registered: Mar 2004
Location: Athens,Greece
Distribution: Debian,Ubuntu
Posts: 181
Rep:
|
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?
|
|
|
|
03-10-2005, 02:47 AM
|
#12
|
|
Senior Member
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 12.3_64-KDE, Ubuntu 12.04, Fedora 17, Mint 14, Chakra
Posts: 3,516
Rep: 
|
Did you also chmod / ?
|
|
|
|
03-10-2005, 02:56 AM
|
#13
|
|
Member
Registered: Mar 2004
Location: Athens,Greece
Distribution: Debian,Ubuntu
Posts: 181
Rep:
|
Quote:
Originally posted by JZL240I-U
Did you also chmod / ?
|
that was it! thank you all guys for helping me out! 
|
|
|
|
03-10-2005, 12:05 PM
|
#14
|
|
LQ Newbie
Registered: Feb 2005
Location: Finland
Distribution: Debian sarge
Posts: 26
Rep:
|
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?
|
|
|
|
03-10-2005, 01:49 PM
|
#15
|
|
Member
Registered: Mar 2004
Location: Athens,Greece
Distribution: Debian,Ubuntu
Posts: 181
Rep:
|
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...
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:49 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|