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 06-02-2006, 02:03 PM   #1
focus1
LQ Newbie
 
Registered: Apr 2006
Distribution: Mandriva 2006
Posts: 11

Rep: Reputation: 0
Directory permissions


Is there is any way to create a special directory, where all the new files created and all the new directoris created under this special directory, wered create with permissions of write and read for all the users?

Thanks
 
Old 06-02-2006, 03:26 PM   #2
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
1) Create a directory and then chown :groupname directory where groupname is a common group that all your users belong to.

2) chmod -R 666 directory -- this sets the directory permissions to read and write for everyone

3) chmod g+s directory -- this sets the "sticky bit", which means all files in this directory will be created with the same group permissions as the directory.

So if you have a directory like
Code:
drw-rw-rw- 2 bob user 1674 Sep 17 1999 user_directory
and set the sticky bit, the directory permissions will look like
Code:
drw-rwsrw- 2 bob user 1674 Sep 17 1999 user_directory
and all files will be created with read write group permissions.
 
Old 06-06-2006, 11:13 AM   #3
focus1
LQ Newbie
 
Registered: Apr 2006
Distribution: Mandriva 2006
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks for your help pljvaldez

I have tried it, but I have some problems if I change permissions of the directory to 666, the other users can't enter to the directory, I have to use 770 permisions to allow all the users of my group to enter to the directory.

And another problem that I have is that using sticky bit, I have created this directory named prova

327253 4 drwxrws--- 2 root marc 4096 jun 6 17:59 prova/

Directory prova has read and write permissions for group but when I create a file named p2, inside the directory

327253 4 drwxrws--- 2 root marc 4096 jun 6 18:07 ./
2 4 drwxr-xr-x 20 root root 4096 jun 6 18:04 ../
327255 4 -rw-r--r-- 1 prova marc 2 jun 6 18:07 p2

Only have write permissions the user, the group not, but It's is a sticky directory, I don't understand why the file is created with out write permissions for the group
 
Old 06-06-2006, 11:28 AM   #4
focus1
LQ Newbie
 
Registered: Apr 2006
Distribution: Mandriva 2006
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks for your help pljvaldez

I have tried it, but I have some problems if I change permissions of the directory to 666, the other users can't enter to the directory, I have to use 770 permisions to allow all the users of my group to enter to the directory.

And another problem that I have is that using sticky bit, I have created this directory named prova

Code:
 327253  4 drwxrws---    2 root marc  4096 jun  6 17:59 prova/
Directory prova has read and write permissions for group but when I create a file named p2, inside the directory

Code:
327253 4 drwxrws---   2 root  marc 4096 jun  6 18:07 ./
     2 4 drwxr-xr-x  20 root  root 4096 jun  6 18:04 ../
327255 4 -rw-r--r--   1 prova marc    2 jun  6 18:07 p2
Only have write permissions the user, the group not, but It's is a sticky directory, I don't understand why the file is created with out write permissions for the group
 
Old 06-06-2006, 04:09 PM   #5
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 51
Quote:
Originally Posted by focus1
I have tried it, but I have some problems if I change permissions of the directory to 666, the other users can't enter to the directory, I have to use 770 permisions to allow all the users of my group to enter to the directory.
Yes, DIRECTORIES NEED EXECUTABLE PERMISSION. Executable is the most important permission for directories. It allows people to enter the directory (and access its contents). Read permission allows listing of the directory, but is otherwise unimportant. Write permission allows creating and deletion of contents. That's why "6" is completely useless; directory permissions usually consist of 7, 5, or 1.

Last edited by spooon; 06-06-2006 at 04:11 PM.
 
  


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
directory permissions allelopath Linux - General 3 01-01-2006 02:43 PM
directory permissions goodolday Linux - Newbie 6 04-28-2005 01:51 AM
Directory Permissions mbjunior99 Mandriva 2 02-27-2005 07:17 PM
Directory Permissions Help artielnx Linux - Newbie 4 07-28-2004 02:25 PM
write permissions for directory - not accidently move/deleted the directory linuxgamer Linux - Newbie 10 12-02-2003 03:04 AM

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

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