[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] change user when executing some script



Hereafter is one of the solutions:

the files handled by the script must reside into a user1 directory
with setgid flag turned on, and 775 permissions mode. All the files
created into this dir will belongs to user1' group. So, user2 will
launch the script and generate a user2,user1group permission file.
When user3 will launch the script later, he will get the user1
permissions thanks to the setguid flag on the script, and will be able
to delete the user2,user1group file. Note that you can set the
sticky-bit on the directory to prevent the erase even if user1 shares
its permissions with others (not the case here).


Gal'

2007/6/14, Galevsky <galevsky@gmail.com>:
Thank you guys. Unfortunately, I cannot do that since I am not root
and can neither add group nor modify any /etc/*. That is the reason
why I was looking for a solution to change the user when executing the
script. setuid and setgid are nice to apply the script owner
permissions to the users, but the file creation is done on behalf of
users and not of script owner. So file deletion..... cannot run.

Gal'



2007/6/14, Bob Proulx <bob@proulx.com>:
> Douglas Allan Tutty wrote:
> > Galevsky wrote:
> > > How can I make the /home/user1/testfile belong to user1, the owner of
> > > the script instead of the user that launches it ?
> >
> > On DEBIAN, to remove a file, you need write permissions on the directory
> > in which it resides.  I suppose user1 could give group write to the
> > directory.  You would then create a group and put user[1-3] in that
> > group.
>
> Yes.  That would be good.
>
> Do this in a subdirectory of your home.  If your $HOME is writable by
> others, group write, then many programs will refuse to trust files
> there.  (e.g. sendmail/postfix/exim, procmail, ssh, etc.)
>
> Bob
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>
>




Reply to: