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
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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
2. UNIX for Dummies Questions & Answers
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
3. Shell Programming and Scripting
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
4. Shell Programming and Scripting
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
5. Shell Programming and Scripting
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
6. Shell Programming and Scripting
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
7. UNIX for Dummies Questions & Answers
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
8. Shell Programming and Scripting
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
9. Shell Programming and Scripting
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
10. Solaris
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
CHGRP(1) User Commands CHGRP(1)
NAME
chgrp - change group ownership
SYNOPSIS
chgrp [OPTION]... GROUP FILE...
chgrp [OPTION]... --reference=RFILE FILE...
DESCRIPTION
Change the group of each FILE to GROUP. With --reference, change the group of each FILE to that of RFILE.
-c, --changes
like verbose but report only when a change is made
--dereference
affect the referent of each symbolic link (this is the default), rather than the symbolic link itself
-h, --no-dereference
affect each symbolic link instead of any referenced file (useful only on systems that can change the ownership of a symlink)
--no-preserve-root
do not treat `/' specially (the default)
--preserve-root
fail to operate recursively on `/'
-f, --silent, --quiet
suppress most error messages
--reference=RFILE
use RFILE's group rather than specifying a GROUP value
-R, --recursive
operate on files and directories recursively
-v, --verbose
output a diagnostic for every file processed
The following options modify how a hierarchy is traversed when the -R option is also specified. If more than one is specified, only the
final one takes effect.
-H if a command line argument is a symbolic link to a directory, traverse it
-L traverse every symbolic link to a directory encountered
-P do not traverse any symbolic links (default)
--help display this help and exit
--version
output version information and exit
EXAMPLES
chgrp staff /u
Change the group of /u to "staff".
chgrp -hR staff /u
Change the group of /u and subfiles to "staff".
AUTHOR
Written by David MacKenzie and Jim Meyering.
REPORTING BUGS
Report chgrp bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
Report chgrp translation bugs to <http://translationproject.org/team/>
COPYRIGHT
Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
SEE ALSO
The full documentation for chgrp is maintained as a Texinfo manual. If the info and chgrp programs are properly installed at your site,
the command
info coreutils 'chgrp invocation'
should give you access to the complete manual.
GNU coreutils 8.12.197-032bb September 2011 CHGRP(1)