The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Change multiple filename formats with WHILE ScKaSx UNIX for Dummies Questions & Answers 5 02-27-2008 04:11 PM
rsh to change multiple ip in multiple servers? kenshinhimura Shell Programming and Scripting 2 02-18-2008 12:04 AM
a bit tricky to change it multiple rows in one row and ... netbanker Shell Programming and Scripting 2 12-31-2007 10:48 PM
I am the owner,yet not allowed the change the ownership MSHETTY UNIX for Dummies Questions & Answers 8 09-25-2007 08:08 PM
How do I change ownership of a directory and all of it's files. mborin UNIX for Dummies Questions & Answers 1 02-25-2001 03:24 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-15-2008
Registered User
 

Join Date: Dec 2007
Location: Philippines, Cebu City
Posts: 67
change multiple ownership

Good afternoon,
Sir's, i owuld like to search for some advice, whats the fastest way to change multiple files ownership. For HostnameA will be their basis, for what ever files and permissions that hostnameA has, it should replicate the permissions and ownership to hostname B.

$hostname
hostnameA
$ pwd
/home/tester
$ ls -l
total 112
drwxr--r-- 3 root staff 256 Jan 03 17:18 a
drwxr-xr-x 2 tester staff 256 Jan 16 12:03 aa
-rwxr--r-- 1 tester staff 398 Jan 02 15:10 awksol.sh
$cd aa
/home/tester/aa
total 32
-rw-r--r-- 1 tester staff 189 Jan 16 11:37 a
-rw-r--r-- 1 tester staff 125 Jan 16 12:03 addd
-rw-r--r-- 1 tester staff 186 Jan 16 11:36 b


$hostname
hostnameB
$ pwd
/home/agent
$ ls -l
total 112
drwxr--r-- 3 root staff 256 Jan 03 17:18 a
drwxr-xr-x 2 agent staff 256 Jan 16 12:03 aa
-rwxr--r-- 1 root staff 398 Jan 02 15:10 awksol.sh
-rwxr--r-- 1 root staff 398 Jan 02 15:10 searcher.sh
$cd aa
/home/agent/aa
total 32
-rw-r--r-- 1 root staff 189 Jan 16 11:37 a
-rw-r--r-- 1 root staff 125 Jan 16 12:03 addd
-rw-r--r-- 1 agent staff 186 Jan 16 11:36 b
-rw-r--r-- 1 testing staff 186 Jan 16 11:36 tryout


output :
$hostname
HostnameB
total 112
drwxr--r-- 3 root staff 256 Jan 03 17:18 a
drwxr-xr-x 2 tester staff 256 Jan 16 12:03 aa
-rwxr--r-- 1 tester staff 398 Jan 02 15:10 awksol.sh
$cd aa
/home/tester/aa
total 32
-rw-r--r-- 1 tester staff 189 Jan 16 11:37 a
-rw-r--r-- 1 tester staff 125 Jan 16 12:03 addd
-rw-r--r-- 1 tester staff 186 Jan 16 11:36 b
Reply With Quote
Forum Sponsor
  #2  
Old 01-17-2008
Registered User
 

Join Date: Sep 2007
Location: Poland
Posts: 63
I don't know what is the problem but you could try tar'ring the files including permissions and then uncompressing them with option "-p" if I remember it.
If this cannot be used and you want to make it on your own, and this is going ot be made trough some script, then I cannot see any other way than just displaying "ls" in some formatted way and then iterating trough the items with chown.
Note that this can be dangerous (especially because you are running this as root)
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:30 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0