Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-03-2011, 09:04 AM   #1
Registered: Oct 2010
Posts: 30

Rep: Reputation: 1
How would I be able to do this with "chown"?

I want to batch-change the file's ownership from person A's to person B's.

Like... in a directory containing 50 files of user A, I want to change all of their ownership to user B.

How would I be able to do this instead of chown-ing every file individually? My internet research was ineffective. Sorry if this post made you gasp. Thanks
Old 09-03-2011, 09:17 AM   #2
Senior Member
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062
You would do this recursively (logged in as root or su - or sudo):
cd directory
chown -R .
Or, if you also want to change the directory ownership (say it's a home directory):
cd /home
chown -R olduser
That's it.

Oops! Forgot one...

If you want to change only those files owned by A you could do this:
cd directory
find . -user A -exec chown B {} \;
You might also use chown above if A was in a different default group than B.

Hope this helps some.

Last edited by tronayne; 09-03-2011 at 09:22 AM.
1 members found this post helpful.
Old 09-03-2011, 09:20 AM   #3
Registered: Apr 2008
Location: UK
Distribution: openSUSE, Fedora
Posts: 386
Blog Entries: 74

Rep: Reputation: 81
This might help:
Old 09-03-2011, 10:08 AM   #4
Registered: Oct 2010
Posts: 30

Original Poster
Rep: Reputation: 1
Thank you for your help. It worked.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Accidentally chown'ed and chmod'ed recursively from "/" dc_eros Slackware 6 06-25-2011 03:45 AM
chown - How do I set the permissions of an entire directory to "all" ? Evan. Linux - Newbie 2 01-17-2010 03:43 AM
All files/Directories owned by root (unable to change with "chown") KinnowGrower Linux - Desktop 8 10-22-2008 11:18 AM
Looking for a remote "chown" command ? MikeAtVillage Linux - Networking 4 05-23-2005 09:41 AM
Need Frontend to "chown" command TippyToes Linux - Software 3 11-24-2004 09:50 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:56 AM.

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