Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script for change root owner

Status
Not open for further replies.

sdabreo

IS-IT--Management
Oct 3, 2002
50
IN
how to change the owner file as root in sharing directory of directories and files.

To avoid every time using this command : chown root:group /directory.....


Anybody know script level, it better to me .


kindly Asap.

Regards
lakshman
 
You could write a script to do this, but I see little advantage.

The chown command takes at least three parameters the user, group and the objects to change.

If you wrote a chown script, you would still need to provide these. If you want to issue the command multiple times, you would be better off to use an existing utility like SED.

 
If the filesystem you are using supports it, you can do this using ACLs. See man setfacl.

You can set the default group on created files using chmod g+s dirname.

Also consider using chown -R to do it recursively on the directory and its contents.

Annihilannic.
 
BUT, EACH & EVERY TIME I HAVE TO GIVE CHOWN COMMAND. FOR THAT I WILL CREATE A SCRIPT FOR CHANGE OWNER. & ALSO I SCHEDULEED IT .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top