LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

Reply
 
Search this Thread
Old 08-19-2006, 12:16 PM   #1
sKAApGIF
LQ Newbie
 
Registered: May 2006
Distribution: SuSE OSS 10.1
Posts: 20

Rep: Reputation: 0
File ownership - changing a whole dir to different owner


I copied files over samba with the setting "map guest to nobody" (or something like that)... So now all files are owned by nobody:nobody

I want to "reclaim" ownership to "username" (my username). I can use the command chown but there's 11000 files... how do I change the user of ALL of them without having to type every file?
 
Old 08-19-2006, 01:01 PM   #2
bernied
Member
 
Registered: Mar 2006
Location: Edinburgh, UK
Distribution: debian
Posts: 304

Rep: Reputation: 30
chown -R user:group /path/to/directory/*
or, if you want the directory changed as well, do the same without the trailing /*
 
Old 08-19-2006, 01:02 PM   #3
bernied
Member
 
Registered: Mar 2006
Location: Edinburgh, UK
Distribution: debian
Posts: 304

Rep: Reputation: 30
man chown
also works well
 
Old 08-19-2006, 08:56 PM   #4
boilertech
LQ Newbie
 
Registered: Mar 2006
Posts: 7

Rep: Reputation: 0
Code:
chown -R
is the command to use
Quote:
-R, --recursive operate on files and directories recursively
 
Old 08-20-2006, 05:42 AM   #5
sKAApGIF
LQ Newbie
 
Registered: May 2006
Distribution: SuSE OSS 10.1
Posts: 20

Original Poster
Rep: Reputation: 0
THanks guys, I'll check it out an let you know
 
Old 08-20-2006, 05:48 AM   #6
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
If the directory contains only files, then you don't need to use recursion (-R). Also, if there are to many files in the directory, then you may need to do something like:

sudo find ./ -type f -execdir chown me:me '{}' \;

This is because bash will try to expand "*" to a list of all of the arguments, which if the directory has thousands of files, could cause a memory error.
 
Old 08-21-2006, 08:25 AM   #7
sKAApGIF
LQ Newbie
 
Registered: May 2006
Distribution: SuSE OSS 10.1
Posts: 20

Original Poster
Rep: Reputation: 0
Thanks

Thanks Got it solved
 
  


Reply


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
Owner of file in shared directory changing Gunbunny Linux - General 4 01-13-2006 07:00 PM
Changing owner and group of file surfbass Linux - General 2 12-12-2005 02:25 PM
changing file ownership /dev/dsp (doesnt work..) icehenge Linux - General 8 03-12-2004 08:48 PM
changing ownership of downloaded file ergo_sum Linux - Newbie 2 09-19-2003 07:58 PM
Changing file ownership on Fat32 drives Steave Linux - General 7 07-30-2001 04:14 PM


All times are GMT -5. The time now is 06:39 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration