How to change Unix permissions when I don't own the file but do have write permission on the directory? How to change Unix permissions when I don't own the file but do have write permission on the directory? unix unix

How to change Unix permissions when I don't own the file but do have write permission on the directory?


There is at least one Unix in which I've seen a way to give someone chmod and chown permissions on all files owned by a particular group. This is sometimes called "group superuser" or something similar.

The only Unix I'm positive I've seen this on was the version of Unix that the Encore Multimax ran.

I've searched a bit, and while I remember a few vague references to an ability of this sort in Linux, I have been unable to find them. So this may not be an option. Luckily, it can be simulated, albeit the simulation is a bit dangerous.

The way to simulate this is to make a very specific suid program that will do the chmod as root after checking that you are a member of the same group as owns the file, and your username is listed as having that permission in a special /etc/chmod_group file that must be owned by root and readable and writeable only by root.


The most straightforward way to do this is to make your partner and you members of a new group (let's say "devel"), and have that as the group of the file. That way it can be owned by either of you, and as long as the group is right, you can both work with it.

If that doesn't work with you, "sudo" can be configured such that only those two users can run a chmod command on files in that specific directory as root with no password.


If you set your umask correctly, the files could be created with the correct permissions in the first place:

$ umask 0022$ touch foo$ ls -l foo-rw-r--r-- 1 sarnold sarnold 0 2011-02-20 21:17 foo$ rm foo$ umask 0002$ touch foo$ ls -l foo-rw-rw-r-- 1 sarnold sarnold 0 2011-02-20 21:17 foo