LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-07-2012, 07:11 PM   #1
iKosmos
LQ Newbie
 
Registered: Dec 2012
Posts: 5

Rep: Reputation: Disabled
[Q] Permission free directory? how?


I have looked around and played with chown, chmod, & setfacl to not avail.

Currently I use an ntfs drive as a shared drive with my family. Every one can read, write, axecutr, and delete anything on it. But I really want to do that now on a linux drive as well.

I want all users to have all permissions to do everything. With setfacl I got everything except delete a few times but nothing was permanant.

Help please!
 
Old 12-07-2012, 07:41 PM   #2
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 1,753

Rep: Reputation: 189Reputation: 189
http://ss64.com/bash/chmod.html
 
Old 12-07-2012, 08:24 PM   #3
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,797
Blog Entries: 4

Rep: Reputation: 285Reputation: 285Reputation: 285
All this can be done using a few commands:
1. Give yourself (let your username is user1) ownership of the shared directory:
Code:
chown user1 /path/to/dir
2. Create a new group named family and add all users to that group.
Code:
groupadd family
usermod -a -G family user1 user2 user3...
3. Change permission mode of shared drive:
Code:
chmod 755 /path/to/dir
So you've excluded write permission for family group, so none other than you can delete content of shared dir. On the other hand you will have full permissions.

Last edited by shivaa; 12-07-2012 at 08:28 PM. Reason: Info added
 
1 members found this post helpful.
Old 12-07-2012, 08:31 PM   #4
iKosmos
LQ Newbie
 
Registered: Dec 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
non protected directories

Will these permissions be inheritable on subdirectories?

Something like a windows samba share with "allow users to change files" checked.
 
Old 12-07-2012, 11:29 PM   #5
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,797
Blog Entries: 4

Rep: Reputation: 285Reputation: 285Reputation: 285
In that case, invoke chown and chmod recursively by just adding -R option, as:
Code:
chown -R user1 /path/to/dir
chmod -R 755 /path/to/dir
It will apply same on all subdirectories and files.

Last edited by shivaa; 12-07-2012 at 11:31 PM. Reason: Formatting
 
1 members found this post helpful.
Old 12-09-2012, 07:39 AM   #6
iKosmos
LQ Newbie
 
Registered: Dec 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by shivaa View Post
In that case, invoke chown and chmod recursively by just adding -R option, as:
Code:
chown -R user1 /path/to/dir
chmod -R 755 /path/to/dir
It will apply same on all subdirectories and files.
Including NEW files/folders created afterwards?
 
Old 12-09-2012, 08:21 AM   #7
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,797
Blog Entries: 4

Rep: Reputation: 285Reputation: 285Reputation: 285
Quote:
Originally Posted by iKosmos View Post
Including NEW files/folders created afterwards?
No! It will not be applied on newly created file/dir. But to achive this, let's go little deeper
Any newly creaeted file/dir gets it permission assigned on basis of umask value defined in your .profile file. If umask entry is commented in .profile (i.e a # written against it) file, then it considers umask values defined under /etc/profile.
So to check it, invoke:
Code:
grep "umask" ~/.profile
If it gives some output (Note: umask is generally set to 022), and if umask is already set to 022, then open the .profile file for editing, remove "#" written against umask entry and also change it's value to 022 if needed. Then any newly created file will get 755 permission by default, which means no write permission to group or others.

Second (perhaps I forgot to mention in previous post), add SGID on shared drive directory, so any newly created file/dir inside it will get same group as that of parant dir. has, using:
Code:
chmod -R g+xs /path/to/dir
---- To summerize all posts, you've to do following -----
1. Change permissions of already existing files/dir/subdirectories to 755:
Code:
chmod -R 755 /path/to/dir
2. Add yourself as owner of all files/dir/subdirectories:
Code:
chown -R username /path/to/dir
3. Set SGID on all dir/subdirectories:
Code:
chmod -R g+xs /path/to/dir
4. Change umask value to 022 (if not already set to 022) and uncomment umask entry from .profile.

And you're done! Test it once and let's know if still you've any problem.

Last edited by shivaa; 12-09-2012 at 08:33 AM.
 
Old 12-09-2012, 08:30 AM   #8
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,592
Blog Entries: 2

Rep: Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046
Quote:
Originally Posted by iKosmos View Post
I have looked around and played with chown, chmod, & setfacl to not avail.

Currently I use an ntfs drive as a shared drive with my family. Every one can read, write, axecutr, and delete anything on it. But I really want to do that now on a linux drive as well.

I want all users to have all permissions to do everything. With setfacl I got everything except delete a few times but nothing was permanant.

Help please!
Before giving any recommendations about file-permissions the real question is: How does your family connect to the shared drive, is it an USB device, a network share, ...?
Most likely this is not a file-permissions thing, but a "How do I setup the sharing service correctly?" problem.
 
Old 12-10-2012, 07:31 AM   #9
iKosmos
LQ Newbie
 
Registered: Dec 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
File Permission on Shared directories

First, thank you everyone.

Second, It is a shared external drive. We have a shared NAS but for larger files we use an external USB hard drive. Normally I have the formatted as NTFS and so anyone can read, write, execute, etc... But I would like to have a partition formatted as ext4 and also I have run into this before where I write a file to an ext3/4 partition and now my kids can not access it.

Also, on a shared laptop I want a data partition that no matter who logs in to the machine, they can read/write/execute anything on the data drive. Again, currently I solve this by leaving the data drive as ntfs but sometimes I WANT permissions on certain directories and none on others. This can only be done in linux if I can be able top create real shared directories that anyone can do anything in this directories without resorting to ntfs partitions.
 
Old 12-10-2012, 07:45 AM   #10
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,592
Blog Entries: 2

Rep: Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046
Are all your machines Linux machines? Windows machines will not be able to read ext4 formatted drives.
 
Old 12-11-2012, 03:55 PM   #11
iKosmos
LQ Newbie
 
Registered: Dec 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Yes all running pclos 2012
 
Old 12-11-2012, 04:46 PM   #12
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,592
Blog Entries: 2

Rep: Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046
In that case the disk should do what you want by default, except that a user can't delete or write to the files a different user has created. Unless all users have the same UID or are member of a group that is present with the same GID on all systems and the group has rwx rights on the files/directories.
I don't know how PCLOS handles the default groups of users, but usually they all should have the same GID on all machines.

Example: On a Debian system the first created user will have the UID 1000, regardless of its username (and if not specified differently by the admin). So if you have two Debian machines the first user on any of those machines can access the files of the first user on the other system, because both have the same UID.

This works similar with groups, of course only if the group has the rights to access the files.

So if all your family members have their own machines with only their user account on it (besides root) it should work out of the box.

Last edited by TobiSGD; 12-11-2012 at 04:49 PM.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Directory execute permission MTK358 Linux - Newbie 2 04-24-2010 10:53 PM
Directory Permission riganta Linux - Newbie 6 05-24-2007 05:20 AM
directory permission leprkhn Linux - Newbie 6 05-02-2007 07:30 PM
directory permission Drunkalot Linux - General 1 07-05-2005 01:05 AM
Permission for directory absolut Linux - Newbie 2 01-19-2004 04:38 AM


All times are GMT -5. The time now is 01:57 PM.

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