You are not logged in.

#1 2010-06-07 23:14:14

gdirty
Member
Registered: 2008-09-10
Posts: 16

giving a user the permissions of another user

I'm sure this is an easy answer but I've had trouble googling it up.
Specifically to my situation, I want to be able to edit things with 755 permissions that are owned http:http
without having to use sudo since that can end up with root owning anything I create, and sometimes I forget to set the permissions back.

Offline

#2 2010-06-08 00:48:35

sand_man
Member
From: Australia
Registered: 2008-06-10
Posts: 2,164

Re: giving a user the permissions of another user

gdirty wrote:

I'm sure this is an easy answer but I've had trouble googling it up.
Specifically to my situation, I want to be able to edit things with 755 permissions that are owned http:http
without having to use sudo since that can end up with root owning anything I create, and sometimes I forget to set the permissions back.

This defeats the purpose of having permissions in the first place.
If you can su to the http user (I doubt it) that will work, otherwise, no.


neutral

Offline

#3 2010-06-08 01:24:22

sisco311
Member
From: Romania
Registered: 2008-05-23
Posts: 112

Re: giving a user the permissions of another user

You can use sudo to run the text editor as another user:

sudo -u username -e file

Or set up some advanced permissions with ACLs or bindfs.


don't drink unwashed fruit juice.
i never make predictions, especially about the future.

Offline

#4 2010-06-10 16:08:06

heidar
Member
From: UK
Registered: 2010-02-04
Posts: 12
Website

Re: giving a user the permissions of another user

If none of the above works you could try setting the files and folders in question to be writeable by the group and add your user to the http group? I am not sure this is a good idea though.

Offline

#5 2010-06-10 22:05:45

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

Re: giving a user the permissions of another user

you can always create a samba mount, and set it up so that all files edited in the samba share are owned by httpd, and THEN mount that locally somewhere the user doing the editing can access.

thats how i handle it in my home network

Offline

#6 2010-06-10 22:10:29

eirika
Member
From: New York
Registered: 2009-09-14
Posts: 65

Re: giving a user the permissions of another user

Have your editor setuid and owned by http? Well this ends up in a way such that everyone
can edit files owned by user http.

Last edited by eirika (2010-06-10 22:13:30)

Offline

#7 2010-06-11 17:29:19

gdirty
Member
Registered: 2008-09-10
Posts: 16

Re: giving a user the permissions of another user

I'm not sure I understand where this "defeats the purpose" entirely.  Yeah I'm guessing su isn't going to work because http doesn't have a shell to use. 

I think I will look at bindfs and ACL.

But consider this scenario, two people want to be able to work in the same directory, but nobody else.  However, group 'foo' has to be able to read everything in it, but nobody else.  How do you manage those permissions?

Offline

#8 2010-06-12 03:58:22

alterecco
Member
Registered: 2009-07-13
Posts: 152

Re: giving a user the permissions of another user

gdirty wrote:

But consider this scenario, two people want to be able to work in the same directory, but nobody else.  However, group 'foo' has to be able to read everything in it, but nobody else.  How do you manage those permissions?

Considering that the group `foo' is also allowed to write to the files and that `other' should have no access, this is an option

sudo groupadd foo
sudo usermod -aG foo user1
sudo usermod -aG foo user2
#relogin both users

sudo mkdir /tmp/foodir
sudo chown foo.foo /tmp/foodir
sudo chmod 770 /tmp/foodir
#set the SGID so files created in dir keep `foo' group
sudo chmod g+s /tmp/foodir

Last edited by alterecco (2010-06-12 03:59:31)

Offline

#9 2010-06-12 15:57:55

sisco311
Member
From: Romania
Registered: 2008-05-23
Posts: 112

Re: giving a user the permissions of another user

gdirty wrote:

But consider this scenario, two people want to be able to work in the same directory, but nobody else.  However, group 'foo' has to be able to read everything in it, but nobody else.  How do you manage those permissions?

HowTo: Create a shared directory for local users (with bindfs).

OR

http://wiki.archlinux.org/index.php/ACL


don't drink unwashed fruit juice.
i never make predictions, especially about the future.

Offline

Board footer

Powered by FluxBB