LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-30-2010, 01:39 PM   #1
mocambo
LQ Newbie
 
Registered: Jun 2009
Posts: 8

Rep: Reputation: 0
Question Replacing ownership of certain files


Is there any working commandline alternative to

# find /some/dir -group xxx -user yyy | chown xxxxx:yyyyy

The main purpose is to replace ownership and goup of certain files in subdirectories. Or nevertheless I need to write shell script for that simple operation ?
 
Old 01-30-2010, 01:47 PM   #2
stonehinge03
LQ Newbie
 
Registered: Jan 2010
Posts: 21

Rep: Reputation: 15
chown -R (for recursive) should work.

Hmmm. No that would change them all. You want to just change those owned by certain users and leave the rest alone, right?

Last edited by stonehinge03; 01-30-2010 at 01:49 PM.
 
Old 01-30-2010, 01:50 PM   #3
ozanbaba
Member
 
Registered: May 2003
Location: İzmir
Distribution: Slackware64 15.0 Multilib
Posts: 778

Rep: Reputation: 135Reputation: 135
find /some/dir -group xxx -user yyy -exec chown xxxx:yyyy {}\;
 
1 members found this post helpful.
Old 01-30-2010, 05:20 PM   #4
mocambo
LQ Newbie
 
Registered: Jun 2009
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by ozanbaba View Post
find /some/dir -group xxx -user yyy -exec chown xxxx:yyyy {}\;
ozanbaba's solution did exactly what I'm looking for except there is extra space needed between {} and \;.

Thanks !
 
Old 01-31-2010, 04:16 AM   #5
ozanbaba
Member
 
Registered: May 2003
Location: İzmir
Distribution: Slackware64 15.0 Multilib
Posts: 778

Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by mocambo View Post
ozanbaba's solution did exactly what I'm looking for except there is extra space needed between {} and \;.

Thanks !
sorry about that
 
Old 01-31-2010, 11:41 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
http://linux.die.net/man/1/chown
Quote:
--from=CURRENT_OWNER:CURRENT_GROUP
change the owner and/or group of each file only if its current owner and/or group match those specified here. Either may be omitted, in which case a match is not required for the omitted attribute.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Default ownership of files and directories linuxdevil Linux - Security 4 06-02-2011 06:25 AM
Compiling: permissions, ownership of files ... JosephS Slackware 1 12-22-2007 01:04 PM
Keeping ownership of files rtcary Linux - Newbie 2 07-17-2005 04:14 PM
Ownership of new Files in SAMBA ghight Linux - Software 6 02-06-2003 10:40 AM
ownership of files changed after upgrade Tinkster Slackware 1 12-20-2002 07:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration