LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 08-28-2007, 11:12 AM   #1
vargadanis
Member
 
Registered: Sep 2006
Posts: 248

Rep: Reputation: 30
Dir permissions to hide it from other users


Hi!

In school we have a server and all users have their own folder in the home dir. But I can read theirs and they can read mine. I would like to remove the read and search attribs but if I do that the httpd wont be able to read the content of the www dir in it. So is there any way to grant certain rights to a dir in general and then make exceptions such as this and this dir can be read and accessed by the nobody group?
thx
 
Old 08-28-2007, 12:56 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
If I'm not mistaken, the execute permission on a directory allows one to enter that directory; read permission allows one to read files in that directory; write permission allows one to write to that directory.

So, remove execute permission for everyone but the student to whom the directory is assigned, and only that student has access.

It should go without saying that root still has access.

Last edited by bigrigdriver; 08-28-2007 at 12:58 PM.
 
Old 08-28-2007, 01:14 PM   #3
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
I think I managed to achieve what you are after by making sure "other" permissions on the user's home dir are set to only execute. In other words, looking like: drwxr-x--x
Code:
win32sux@candystore:~$ sudo groupadd eraseme
win32sux@candystore:~$ sudo useradd -g eraseme -m -s /bin/bash eraseme
win32sux@candystore:~$ sudo mkdir /home/eraseme/www
win32sux@candystore:~$ sudo touch /home/eraseme/secret.txt
win32sux@candystore:~$ sudo touch /home/eraseme/www/public.txt
win32sux@candystore:~$ sudo chown -R eraseme:eraseme /home/eraseme
win32sux@candystore:~$ sudo chmod 751 /home/eraseme
win32sux@candystore:~$ sudo chmod 755 /home/eraseme/www
win32sux@candystore:~$ ls /home/eraseme
ls: /home/eraseme: Permission denied
win32sux@candystore:~$ ls /home/eraseme/www
public.txt
Notice that the commands in bold were executed as non-root.

Just my

Last edited by win32sux; 08-28-2007 at 01:46 PM.
 
Old 08-28-2007, 04:05 PM   #4
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
setfacl, getfacl,...
 
Old 09-02-2007, 03:03 AM   #5
vargadanis
Member
 
Registered: Sep 2006
Posts: 248

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by win32sux View Post
I think I managed to achieve what you are after by making sure "other" permissions on the user's home dir are set to only execute. In other words, looking like: drwxr-x--x
Code:
win32sux@candystore:~$ sudo groupadd eraseme
win32sux@candystore:~$ sudo useradd -g eraseme -m -s /bin/bash eraseme
win32sux@candystore:~$ sudo mkdir /home/eraseme/www
win32sux@candystore:~$ sudo touch /home/eraseme/secret.txt
win32sux@candystore:~$ sudo touch /home/eraseme/www/public.txt
win32sux@candystore:~$ sudo chown -R eraseme:eraseme /home/eraseme
win32sux@candystore:~$ sudo chmod 751 /home/eraseme
win32sux@candystore:~$ sudo chmod 755 /home/eraseme/www
win32sux@candystore:~$ ls /home/eraseme
ls: /home/eraseme: Permission denied
win32sux@candystore:~$ ls /home/eraseme/www
public.txt
Notice that the commands in bold were executed as non-root.

Just my
That is awesome! thanx man... it helped me a lot. Now I have not feeling tht anybody can read anything I put on the server.
 
Old 09-02-2007, 10:08 PM   #6
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by vargadanis View Post
That is awesome! thanx man... it helped me a lot. Now I have not feeling tht anybody can read anything I put on the server.
You're very welcome. BTW, when I was doing the test I forgot that in the OP you mentioned you wanted /home/*/www to be readable by the nobody group. Even though my example works (/home/eraseme/www is readable by anyone), I should have probably tightened it up like:
Code:
sudo chmod 750 /home/eraseme/www
sudo chown eraseme:nobody /home/eraseme/www
A very minor detail, perhaps I should get checked for OCD.

Last edited by win32sux; 09-02-2007 at 10:32 PM.
 
Old 09-03-2007, 11:35 PM   #7
vargadanis
Member
 
Registered: Sep 2006
Posts: 248

Original Poster
Rep: Reputation: 30
What is OCD?
 
Old 09-03-2007, 11:37 PM   #8
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by vargadanis View Post
What is OCD?
It's Obsessive-compulsive disorder.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Compress dir keep file/dir permissions powadha Linux - General 1 11-14-2006 07:07 PM
Hide files with permissions? TomalakBORG Linux - Newbie 12 02-10-2006 05:09 PM
to hide users from 'net' Ygrex Linux - Networking 0 11-24-2005 11:20 AM
samba: hide shares from some users v3rb0 Linux - Software 4 08-10-2003 01:12 AM
Is it possible to hide users from the 'who' and 'w' commands? BxBoy General 8 03-30-2003 01:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 03:34 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration