LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 05-14-2012, 02:26 AM   #1
madisj
LQ Newbie
 
Registered: May 2012
Posts: 2

Rep: Reputation: Disabled
Read ony and and access files, pleas help!?


Hi.

I have shared a folders .../folder1/folder2/folder3
And set full access to group1, to all folders and subfolders

Now i need that one user1 can acces only folder3 and the group can have full access, like it is at the moment.
User1 must have only acces to folder2 files.

Please help ????
 
Old 05-14-2012, 04:19 AM   #2
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
Welcome to LQ Security.

Let's start by asking what have your tried so far? Are you familiar with how Linux permissions works with read, write, and execute access control for the owner, group, and others? The potential trouble you face with your structure is that if you make folder3 a sub folder of one and two, that user1 won't be able to access folder3 because of the path traversal.

Try this experiment: as root, under the root directory, /root create folder1, folder2, folder3 as in your structure. Then change the permissions on folder1 and folder2 to disallow others and group read access. Since they are directories you must keep the execute permission for them to be useable. So, issue "chmod og-r" on folder1 and folder2. Then create a small text file in each of the three folders. Now, become a normal user and try to read the files. You won't be able to. Neither will you be able to cd to the directories. The problem is that you lack read permission on /root, which prohibits you from accessing the stuff below it.

Now, (as root) move this folder structure to /, which is still root territory, but a normal user can read the folder. You should now see that a normal user can cd to folder3, and access it's contents, but can not read the contents of folder1 and folder 2. See the block below for an example of the results.

Alternatively, you can use a tool such as SELinux to provide user based MAC, Mandatory, Access, Control, but that gets into a very advanced topic. I mention it only because as you search for solutions you will likely come across it and while it is a solution, it is one that is not necessary for your situation.

Code:
bash-4.2$ ls /folder1
ls: cannot open directory /folder1: Permission denied
bash-4.2$ ls /folder1/folder2
ls: cannot open directory /folder1/folder2: Permission denied
bash-4.2$ ls /folder1/folder2/folder3
file3  file3~
bash-4.2$ cd /folder1
bash-4.2$ ls
ls: cannot open directory .: Permission denied
bash-4.2$ cd /folder1/folder2/  
bash-4.2$ ls
ls: cannot open directory .: Permission denied
bash-4.2$ cd folder3
bash-4.2$ ls
file3  file3~
bash-4.2$ cat file3
this is a file with some stuff in it!

bash-4.2$ pwd
/folder1/folder2/folder3
bash-4.2$ 


And here is the entire structure:

root@slacker:~# cd /
root@slacker:/# ls -laR folder1
folder1:
total 12
drwx--x--x  3 root root 4096 May 14 05:09 ./
drwxr-xr-x 24 root root 4096 May 14 05:07 ../
-rw-r--r--  1 root root    0 May 14 05:09 file1
drwx--x--x  3 root root 4096 May 14 05:09 folder2/

folder1/folder2:
total 12
drwx--x--x 3 root root 4096 May 14 05:09 ./
drwx--x--x 3 root root 4096 May 14 05:09 ../
-rw-r--r-- 1 root root    0 May 14 05:09 file2
drwxr-xr-x 2 root root 4096 May 14 05:09 folder3/

folder1/folder2/folder3:
total 12
drwxr-xr-x 2 root root 4096 May 14 05:09 ./
drwx--x--x 3 root root 4096 May 14 05:09 ../
-rw-r--r-- 1 root root   38 May 14 05:09 file3
-rw-r--r-- 1 root root    0 May 14 05:09 file3~
root@slacker:/#
 
Old 05-14-2012, 04:32 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Are you talking about network shares, or users on a Linux system? By folders I assume you mean directories.

For users on a Linux system, if you want finer control over access, look at using ACLs. The filesystem needs to support ACLs, which means a Linux based filesystem.

If you are talking about network shares, please provide details on whether you are using Samba or NFS.

You could also provide more details on the directories. You're example shows relative directories.
Are they /home/folder1/folder2/folder3 or /home/user/folder1/folder2/folder3?

Also look at the sticky bit. It is used for world writable directories, which folder1 might be. It prevents a user from deleting another user's file when both users have write access on the directory.
 
Old 05-14-2012, 04:51 AM   #4
madisj
LQ Newbie
 
Registered: May 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
I have Debian 6 and samba share, with groups.
One existing user like "user7" needs to have write access to foder3 on shares/folder1/folder2/folder3
At the moment all the folders have group1 full access, the owner is "user7", others have read access.
I need to manage how to give acces for "user7" with write permission to one of the subfolder "folder3"!???
I am newbie in linux.
 
  


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
how do i access files off cd that are read-only e3l Linux - Newbie 8 02-27-2006 11:41 PM
Read-only access to files that should be RWX DigitalScience LinuxQuestions.org Member Intro 2 01-18-2006 02:16 PM
Read-only access to files that should be RWX DigitalScience Linux - Security 1 01-18-2006 09:40 AM
access to read only files absalon Linux - Newbie 4 06-22-2005 06:31 AM
read-only access to my own /home files esteeven Linux - General 7 07-16-2004 10:27 PM

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

All times are GMT -5. The time now is 06:59 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