Sponsored Content
Top Forums Shell Programming and Scripting Search and replace without changing ownership Post 302411905 by dheian on Friday 9th of April 2010 05:18:13 PM
Old 04-09-2010
That's correct. I was running as root. I see from man sed that the -c switch should do the trick:

-c, --copy

use copy instead of rename when shuffling files in -i mode
(avoids change of input file ownership)
 

10 More Discussions You Might Find Interesting

1. Solaris

Diectory ownership ...changing

Help...... I am running a 420R w/sol 8 and I am trying to install sun's monitoring software srs netconnect. I have installed it on 6 other boxes with no problem. Installation failed with the message: ## Installing part 1 of 1. /etc/opt/SUNWsrspx/CustomerCert.pem... (6 Replies)
Discussion started by: finster
6 Replies

2. UNIX for Dummies Questions & Answers

copy directory without changing ownership setting

hi currently i am migrating some directories over to a new server. is there any command (rcp or ftp or anything) for me to use without changing the ownership and permission of the directory? i am copying some directories from unix machine to linux machine. what is the exact command? thanks... (2 Replies)
Discussion started by: legato
2 Replies

3. UNIX for Advanced & Expert Users

File group ownership changing automatically

Hi everyone, Need help with an issue. The group ownership of files on my Solaris system is getting changed automatically. Could someone tell me the reason why? And how could I correct it? One more info- everytime the ownership changes, it changes to "x". Thanks :confused: (1 Reply)
Discussion started by: top_gun
1 Replies

4. Red Hat

changing wtmp ownership and permission

Hi, I am using redhat AS 3. Recently, I was asked to implement a security control on the OS: to change ownership of /var/log/wtmp to root:sys and permission to 600. However, when I made the change and reboot the machine, everything was reverted. How come? Please help. The following is the... (1 Reply)
Discussion started by: voa2mp3
1 Replies

5. Shell Programming and Scripting

Perl: Search for string on line then search and replace text

Hi All, I have a file that I need to be able to find a pattern match on a line, search that line for a text pattern, and replace that text. An example of 4 lines in my file is: 1. MatchText_randomNumberOfText moreData ReplaceMe moreData 2. MatchText_randomNumberOfText moreData moreData... (4 Replies)
Discussion started by: Crypto
4 Replies

6. UNIX for Dummies Questions & Answers

changing ownership?

how would i change ownership of file1 so the user NATE gets ownership of the file? (1 Reply)
Discussion started by: trob
1 Replies

7. Shell Programming and Scripting

awk - replace number of string length from search and replace for a serialized array

Hello, I really would appreciate some help with a bash script for some string manipulation on an SQL dump: I'd like to be able to rename "sites/WHATEVER/files" to "sites/SOMETHINGELSE/files" within the sql dump. This is quite easy with sed: sed -e... (1 Reply)
Discussion started by: otrotipo
1 Replies

8. UNIX for Dummies Questions & Answers

regarding changing ownership and group

i am able to change the mode using chmod and able to change permission. but i am not able to change group and ownership. getting as invalid can any one help me regarding this . (4 Replies)
Discussion started by: satheeshkr_cse
4 Replies

9. Shell Programming and Scripting

Changing ownership of a directory, subdirectory and files as same as in another server

accidentally i have changed ownership of a directory,subdirectory and files wil below command. I want to the change ownership back as same as in same directory on another server. How can i do it? chown -R user:group /u01 is there any simple script? it is really an urgent need.. (2 Replies)
Discussion started by: johnveslin
2 Replies

10. Solaris

User's Home directory ownership is changing Automatically

Hi , on my Solaris 10 machine user's home directory ownership is being changed automatically to their UID. can any one please tell me whats the reason behind it . users are there in /etc/passwd file . /etc/shadow file is also there along with nssswitch.conf file and there is no changes made to... (5 Replies)
Discussion started by: usernew
5 Replies
cpacl(3C)																 cpacl(3C)

NAME
cpacl(), fcpacl() - copy the access control list (ACL) and mode bits from one file to another (HFS and JFS File Systems only) SYNOPSIS
Remarks To ensure continued conformance with emerging industry standards, features described in this manual entry are likely to change in a future release. DESCRIPTION
Both (HFS and JFS file systems) and (HFS file systems only) copy the access control list and mode bits (that is, file access permission bits and miscellaneous mode bits; see chmod(2)) from one file to another, and transfer ownership much like chown(2). can only copy HFS ACLs to other HFS files and JFS ACLS to other JFS files; it does not covert HFS ACLs to JFS ACLs or vice versa. and take the following parameters: o Path names (fromfile and tofile) or open file descriptors (fromfd and tofd). o A mode value (frommode, typically the value returned by - see stat(2)) containing file miscellaneous mode bits which are always copied, and file access permission bits which are copied instead of the access control list if either file is remote. o User ID and group ID of the file (fromuid, touid and fromgid, togid) for transferring ownership. (Typically fromuid and fromgid are the and values returned by and touid and togid are the return values from and - see geteuid(2) and getegid(2) in getuid(2)). When both files are local, the routines copy the access control list and call (HFS only; see chownacl(3C)) to transfer ownership from the fromfile to the tofile, if necessary. handles remote copying (via NFS) and copying from HFS to JFS or vice versa after recognizing failures of or (see acl(2) and setacl(2)). When copying the mode from fromfile (fromfd) to tofile (tofd), copies the entire frommode (that is, the file miscellaneous mode bits and the file access permission bits) to tofile (tofd) using Some of the miscellaneous mode bits can be turned off; see chmod(2). can copy an access control list from fromfile (fromfd) to tofile (tofd) without transferring ownership, but ensuring error checking and handling of remote files. This is done by passing fromuid equal to touid and fromgid equal to togid (that is, four zeros). For remote files, fromuid, touid, fromgid, and togid are ignored. RETURN VALUE
If successful, and return zero. If an error occurs, they set to indicate the cause of failure and return a negative value, as follows: -1 Unable to perform or on a local fromfile (fromfd). -2 Unable to perform on tofile (tofd) to set its file miscellaneous mode bits. attempts this regardless of whether a file is local or remote, as long as fromfile (fromfd) is local. -3 Unable to perform or on a local tofile (tofd). As a consequence, the file's optional ACL entries are deleted (HFS only), its file access permission bits are zeroed, and its miscellaneous mode bits might be altered. -4 Unable to perform on tofile (tofd) to set its mode. As a consequence, if fromfile (fromfd) is local, tofile's (tofd's) optional ACL entries are deleted (HFS only), its access permission bits are zeroed, and its file miscellaneous mode bits might be altered, regardless of whether the file is local or remote. EXAMPLES
The following code fragment gets stat information on and copies its file miscellaneous bits and access control list to owned by the caller. If either file is remote, only the on is copied. DEPENDENCIES
and are only supported on HFS and JFS file systems on standard HP-UX operating systems. AUTHOR
and were developed by HP. SEE ALSO
acl(2), chown(2), getacl(2), getegid(2), geteuid(2), getuid(2), setacl(2), stat(2), acltostr(3C), chownacl(3C), strtoacl(3C), acl(5), aclv(5), thread_safety(5). cpacl(3C)
All times are GMT -4. The time now is 02:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy