LinuxQuestions.org
Help answer threads with 0 replies.
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 05-07-2013, 08:51 PM   #1
chowder
LQ Newbie
 
Registered: May 2013
Posts: 2

Rep: Reputation: Disabled
Folder Permissions


I would like to know how can I set up folder permissions when using chmod for:

Owner Permissions: All Permissions

Group Permissions
: List folder contents, open files, append to existing files, and run scripts. Cannot delete files or create new ones.

Other Permissions
: List folder contents only

I'm entering the command:
# chmod 755 folder

Is 755 the right permission??

Thanks in advance
 
Old 05-07-2013, 09:27 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
You're going about this in a slightly wrong way. The permissions on a directory (what you call a folder) only affect if users can list, delete, and create files in that directory. They don't affect what users can do to the files (e.g. whether they can edit them or run them). Only the permissions on the files contained in the directory themselves determine that.

If you chmod the directory 0755, only the owner can create or delete new files in the directory. Users in the group and other users will be able to change into the directory and list its file.

If you want to allow members of the group to append files, you must do things. First, they must have write permissions on them. Second, you must set the file append-only using "chattr +a". You'll need to note two things: (1) I believe only the root user can set a file to be append only (this may be a setting somewhere), and (2) this setting applies to all users, even the file's owner. There's no way that I know of to have a file append-onky for some users and not for others. To do what you want, you might need to allow the file's owner to unset the "append-only" attribute and then re-set it (this could be done using sudo).

So setting the directory to 0755 is a good start. However, you must then set the permission on each file in the directory to 0660 for normal files and 0750 for scripts. Then, for regular files you must use chattr to make them append only.

Note that this assumes that no other ACLs (see "man setfacl" and "man getacl" for details).
 
1 members found this post helpful.
Old 05-07-2013, 09:35 PM   #3
chowder
LQ Newbie
 
Registered: May 2013
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks for your response mate!!!
 
Old 05-07-2013, 10:33 PM   #4
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
I think you should add permission of 754. Or moreover add sticky bit on the folder so only root, folder owner, or file owner will be able to delete/rename a file.

Code:
~$ chmod 754 /path/to/folder
OR
~$ chmod 754 /path/to/folder
~$ chmod a+t /path/to/folder
Note in that case, others will not be able to execute any file or script from that folder. Else if its not an issue, then you can set 755 plus sticky bit.

For more details check: http://linux.die.net/man/1/chmod
 
  


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
Changing folder permissions and its sub folder and files? stratotak Linux - Newbie 6 12-29-2011 05:11 AM
Permissions on One Folder? carlosinfl Ubuntu 3 10-10-2007 12:50 PM
folder permissions sharathkv25 Linux - General 3 04-12-2007 12:39 PM
folder permissions lpn1160 Linux - General 4 10-29-2006 08:46 AM
permissions difference between /home/..../folder and /root/folder darkleaf Linux - General 3 07-21-2005 05:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration