You are not logged in.

#1 2008-06-15 14:05:16

noname
Member
Registered: 2008-06-13
Posts: 9

[SOLVED] directory access

hi everyone : D

how do I make a directory (and all the subdirectories) accessible/writable by all users?

thx

Last edited by noname (2008-06-15 14:29:01)


~Seek

Offline

#2 2008-06-15 14:08:25

ThomasAdam
Member
From: Southampton, England
Registered: 2005-10-26
Posts: 148

Re: [SOLVED] directory access

Either you can set:

find /some/dir -type d -print0 | xargs -0 chmod o+rwx

Or just assign the directories to a specific group, put the users in them, and then you're away.

-- Thomas Adam

Last edited by ThomasAdam (2008-06-15 14:09:00)

Offline

#3 2008-06-15 14:12:15

noname
Member
Registered: 2008-06-13
Posts: 9

Re: [SOLVED] directory access

ThomasAdam wrote:

Either you can set:

Or just assign the directories to a specific group, put the users in them, and then you're away.

-- Thomas Adam

Very interesting, but how can i do this?


~Seek

Offline

#4 2008-06-15 14:19:44

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: [SOLVED] directory access

chown user:group directory

or see man chown.

Offline

#5 2008-06-15 14:21:06

ThomasAdam
Member
From: Southampton, England
Registered: 2005-10-26
Posts: 148

Re: [SOLVED] directory access

noname wrote:
ThomasAdam wrote:

Either you can set:

Or just assign the directories to a specific group, put the users in them, and then you're away.

-- Thomas Adam

Very interesting, but how can i do this?

Well, create a group:

# groupadd mygroup

Then assign your users to that group:

# usermod -aG mygroup someuser

Then set the directory to have the ownership of the group:

# find /some/dir -type d -print0 | xargs -0 chgrp mygroup

Note that you've explicitly stated just the directory and sub-directories which excludes any files therein, of course.  You should also ensure that the group permissions on the directories are g+rwx so you allow any members of that group to read and write as appropriate.  This approach is slightly better, since you can control which users you allow access to these directories.

-- Thomas Adam

Offline

#6 2008-06-15 14:28:38

noname
Member
Registered: 2008-06-13
Posts: 9

Re: [SOLVED] directory access

ok i've understanded, thx alot!


~Seek

Offline

#7 2008-06-15 15:01:55

Zepp
Member
From: Ontario, Canada
Registered: 2006-03-25
Posts: 334
Website

Re: [SOLVED] directory access

ThomasAdam wrote:

Either you can set:

find /some/dir -type d -print0 | xargs -0 chmod o+rwx

Or just assign the directories to a specific group, put the users in them, and then you're away.

-- Thomas Adam

There is no need to pipe

find /some/dir -type d -exec chmod o+rwx {} \;

Offline

#8 2008-06-15 15:34:10

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: [SOLVED] directory access

Zepp wrote:

There is no need to pipe

find /some/dir -type d -exec chmod o+rwx {} \;

That can be nasty when the output of find is very large, xargs handles that better by controlling the flow of arguments to chmod. I've read about this on a site once but I've lost that source...

Last edited by Ramses de Norre (2008-06-15 15:34:33)

Offline

#9 2008-06-15 23:47:09

Zepp
Member
From: Ontario, Canada
Registered: 2006-03-25
Posts: 334
Website

Re: [SOLVED] directory access

Ramses de Norre wrote:
Zepp wrote:

There is no need to pipe

find /some/dir -type d -exec chmod o+rwx {} \;

That can be nasty when the output of find is very large, xargs handles that better by controlling the flow of arguments to chmod. I've read about this on a site once but I've lost that source...

I have never encountered such a problem so I am not sure what exactly you are referring to sad. Oh well.

Offline

#10 2008-06-15 23:55:49

ThomasAdam
Member
From: Southampton, England
Registered: 2005-10-26
Posts: 148

Re: [SOLVED] directory access

Zepp wrote:

I have never encountered such a problem so I am not sure what exactly you are referring to sad. Oh well.

The input buffer is finite -- hence if there's a lot of directories you're working in (and there *could* be) you need to use xargs to make sure that handles things properly.

This was purportedly solved earlier on today.

-- Thomas Adam

Offline

Board footer

Powered by FluxBB