Visit Our UNIX and Linux User Community


change multiple ownership


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting change multiple ownership
# 1  
Old 01-16-2008
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
# 2  
Old 01-17-2008
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)

Previous Thread | Next Thread
Test Your Knowledge in Computers #747
Difficulty: Medium
The Z80 uses 248 out of the available 256 codes as single byte opcodes.
True or False?

10 More Discussions You Might Find Interesting

1. Solaris

How to set multiple ownership permission on a file/directory?

Hi, Any ideas to set multiple ownership permission on a file/directory on Solaris? I need a folder to have multiple ownership on the 2 nodes servers. The 2 nodes servers require to mount a SMBFS with different user ID. Please assist. Thanks. (6 Replies)
Discussion started by: freshmeat
6 Replies

2. Shell Programming and Scripting

Change one line to multiple

I did help some at another forum to change one line to multiple lines. var1="abc001: text goes here yyy003: text goes here uuuu004: text goes here" Running this awk, gives correct result, but its not very nice. Any idea on how to simplify it? awk '{for (i=1;i<=NF;i++) printf $i~":"?"\n"$i" ":$i"... (7 Replies)
Discussion started by: Jotne
7 Replies

3. Shell Programming and Scripting

Change name of multiple files

Hi Guys Please can you help me. I have a lot of files whit wrong name example 00000500_001.segd 00000501_001.segd 00000502_001.segd 00000503_001.segd 00000504_001.segd I would like to remove _001 in all files So, the files shouldbe 00000500.segd 00000501.segd 00000502.segd... (2 Replies)
Discussion started by: jiam912
2 Replies

4. UNIX for Dummies Questions & Answers

Change ownership of a directory

I want to change the ownership of a directory ONLY. my id id1 owns the files under the /mypath/bin but /mypath/bin is owned by id2 If i log into id2 I can't do chown id1 /mypath/bin (1 Reply)
Discussion started by: klarue
1 Replies

5. Shell Programming and Scripting

change multiple file names

Hi is it possible to change multiple files (~10k) names with out disturbing the data in it. ? input Hynda|cgr10(+):100027702-1000312480|.txt Hynda|cgr10(+):100027702-1000312483|.txt Hynda|cgr10(+):100027702-1000312484|.txt Hynda|cgr10(+):100027702-1000312482|.txt output... (4 Replies)
Discussion started by: quincyjones
4 Replies

6. Shell Programming and Scripting

File Ownership Change

Hi, I have several directories under an upload directory where differnt users upload their files (with exxactly the same file name every week) using their own user ids. There is a requirement that once any user uploads the file I have to clean that file and remove extra whitespaces and... (3 Replies)
Discussion started by: vbhonde11
3 Replies

7. Shell Programming and Scripting

To change the ownership at one shot

i have a directory in which i have Multiple files: Following are they==== -rw-r--r-- 1 root root 886 Jan 21 16:38 trunkn.xsd -rw-r--r-- 1 root root 244 Jan 21 16:38 trunknameCache.xml -rw-r--r-- 1 root root 1240 Jan 21 16:38 subscribercache.xsd -rw-r--r-- 1 root ... (1 Reply)
Discussion started by: Aditya.Gurgaon
1 Replies

8. Shell Programming and Scripting

rsh to change multiple ip in multiple servers?

good day. i jsut wanted to know what is the best script or the best way changing a lot of Ip's in all servers. Do you have any idea? im using awk to change IP,what if, you have lots of servers. You need to change it one by one? It will take time to change it manually. (2 Replies)
Discussion started by: kenshinhimura
2 Replies

9. UNIX for Dummies Questions & Answers

I am the owner,yet not allowed the change the ownership

sm860 IS the owner of the files below,but yet sm860 cannot change the ownership to bpt3a1.Please let me know why ? See below for details --- sm860@unixs741_DEV:/usr/gdp/home/ftp/bpt3a1/incoming/ahdb/T5/pcasav/daily $ ls -l pcasav* -rw-r--r-- 1 sm860 gdpintegrators 821 Sep 21 16:15... (8 Replies)
Discussion started by: MSHETTY
8 Replies

10. UNIX for Dummies Questions & Answers

How do I change ownership of a directory and all of it's files.

How do I change ownership of a directory and all of it's files without changing permissions? (1 Reply)
Discussion started by: mborin
1 Replies

Featured Tech Videos