You are not logged in.

#1 2010-06-16 19:21:07

Flasher
Member
From: Bavaria / Germany
Registered: 2005-04-24
Posts: 126

Changing owner of folder within a script

Hi!

I think I have a simple problem to solve:
I (my user name is andreas) am the owner of a folder "test":

drwxr-sr-x 2 andreas global_archive     4096 Jun 16 15:58 test

I would like to change the owner. The new owner should be root. It should therefore be shown as follows:

drwxr-sr-x 2 root global_archive     4096 Jun 16 15:58 test

Problem is that this operation is not allowed:

chown: changing ownership of `test': Operation not permitted

My command is as follows:

chown root.global_archive test

Presumably this is a security feature of the system by themselves do not lock out.
Since this operation is performed within a script and I do not want to run this script as root (or can not) I would be very grateful for a reference!

Thanks for your help! Best regards,

Flasher

Offline

#2 2010-06-16 19:39:07

ZaQ
Member
Registered: 2009-12-12
Posts: 106

Re: Changing owner of folder within a script

AFAIK root authority is needed.

So sudo is the best that comes to my mind. (i.e. execute the script via sudo with the "pseudo root authority", allow chmod via sudo,...)


ZaQ

Last edited by ZaQ (2010-06-16 19:40:14)

Offline

Board footer

Powered by FluxBB