You are not logged in.

#1 2007-01-22 12:28:34

dw
Member
From: Vienna, Austria
Registered: 2006-11-25
Posts: 160

chmod / chown / umask

Hi there. I have the following problem.

At home we have a "family-pc" which runs arch. Every family member has an account on this computer. I get a brand-new harddisk which I wanted to use as a data-storage for digital images, music and documents for the entire family.

I formated the disk with ext3 filesystem and mounted it to /mnt/share. I created a group "share" and added every existing user to the group "share". What I want is the following. I want to have _everyone_ fully read/write/execute rights on this partition. That means, that if user A creates a folder, user B should be able to delete it,... (i know one should not do this but I want to and have to...).

I can

chown root:share /mnt/share -R; chmod 2777 /mnt/share -R

as root, which _should_ be enough.

The problem is, that whenever user A creates a folder on /mnt/share, the group rights of this folder for usergroup "share" are "read only". So it seems to me that mkdir overrides some settings.

Anyone who can help me on how to solve my problem?

Thanks in advance...

Offline

#2 2007-01-22 12:39:45

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: chmod / chown / umask

Try mounting it with "gid=share,umask=0002" option (place that in fstab in 4th column).

Offline

#3 2007-01-22 13:04:43

dw
Member
From: Vienna, Austria
Registered: 2006-11-25
Posts: 160

Re: chmod / chown / umask

lucke wrote:

Try mounting it with "gid=share,umask=0002" option (place that in fstab in 4th column).

Hi Lucke.

Thx for your answer. I forgot to mention that I already tried this. The problem is that it seems one can't mount an ext3 partition with gid / umask parameters. This results in a "bad superblock on..." message.

Bernhard

Offline

#4 2007-01-22 13:25:26

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: chmod / chown / umask

dw you want the sticky bit set. That grants permissions  only to  the user who created the file or directory.

So try something like this:

chown root:share /mnt/share
chmod 1775 /mnt/share

and add your users to the share group.

Anyone from share group can create directories or files in /mnt/share and only the original user can delete/modify his own files.

Offline

#5 2007-01-22 13:27:50

dw
Member
From: Vienna, Austria
Registered: 2006-11-25
Posts: 160

Re: chmod / chown / umask

T-Dawg wrote:

dw you want the sticky bit set. That grants permissions  only to  the user who created the file or directory.

So try something like this:

chown root:share /mnt/share
chmod 1775 /mnt/share

and add your users to the share group.

Hi T-Dawg.

I've tried both

chmod 1777 /mnt/share -R

and

chmod 2777 /mnt/share -R

but whenever a user creates a directory, the group-rights are set to read-only sad

Offline

#6 2007-01-22 14:31:54

Snarkout
Member
Registered: 2005-11-13
Posts: 542

Re: chmod / chown / umask

I've run into the same issue in the past, for a job, and unfortunately the only solutions I could come up with were:

1) Change the default umask to 0002 - probably a bad idea since this is a global setting.

2) Use a different filesystem that honors the fstab umask setting - didn't really research this, not sure if it'll work with directory creation or not.

3) Setup a cron job that chown's the mount once every few minutes.

I went with 1, but it's a shitty solution to a problem created by a filesystem that seems to assume that it knows more than you do.  The ONLY reason I chose #1 is that the box was behind a firewall, there was no lagtime, and these users wouldn't ever be accessing anything outside that one directory anyhow.


Unthinking respect for authority is the greatest enemy of truth.
-Albert Einstein

Offline

#7 2007-01-22 15:12:00

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: chmod / chown / umask

Maybe it's possible with ACLs?

Never dug into those.

Setting global umask (in /etc/profile) could be also an option, as mentioned, although obviously not so desirable.

-edit-

mkdir has a -m flag which allows you to specify mode. That's a solution for creating dirs, at least from CLI (a lil' alias would be nice).

Files seems to be an other story, however.

-edit-

Read and digest.

Offline

#8 2007-01-22 18:18:47

sergejx
Member
From: Czechoslovakia
Registered: 2006-10-24
Posts: 9
Website

Re: chmod / chown / umask

I had the same problem and it seems that solution is ACL. You can set default permissions for files and directories created in some directory. For example to set read/write permissions for group you can do this:

 setfacl -d -m g::rwx /mnt/share

These settings are also inherited by subdirectories created in this directory.

It can also be useful to set setgid bit for directory.

Offline

Board footer

Powered by FluxBB