Results 1 to 6 of 6
I would like to change the ownership of some all folders and files within them folders by making changes to parentfolder. But I mess it up.
The folder path is ...
- 02-09-2011 #1Just Joined!
- Join Date
- Jan 2011
- Posts
- 93
How to CHOWN all folders within a folder?
I would like to change the ownership of some all folders and files within them folders by making changes to parentfolder. But I mess it up.
The folder path is /home/myaccount/shared/target_folder.
Target folder holds several new folders with files inside. How can I easily change ownership to all folders and files within target_folder?
I tried this:
But I get error:Code:sudo chown myusername /home/myusername/shared/target_folder
Sure there are something wrong with my input .Unnable to resolve. No such file or directory.Last edited by piergen; 02-09-2011 at 01:24 PM.
- 02-09-2011 #2
Try the man pages. The answer is there.
Code:man chown
I do not respond to private messages asking for Linux help, Please keep it on the forums only.
All new users please read this.** Forum FAQS. ** Adopt an unanswered post.
- 02-09-2011 #3Just Joined!
- Join Date
- Jan 2011
- Posts
- 93
Btw I have corrected the code in post #1, I had forgotten to put in chown.
Hmm tried man shown but couldnt make anything out of it, cause that seems just what I allready tried and could not get to work, except the <-hR> part. At least I should be able to get parent folder owner to change by using the line I did earlier.
The example said this:
chown -hR root /u
Change the owner of /u and subfiles to "root
- 02-09-2011 #4Just Joined!
- Join Date
- Nov 2010
- Posts
- 61
yes you need to use the "-R" switch on the parent folder. The -R switch (recursive) applies the permissions to all files and sub directories inside the parent folder.
- 02-09-2011 #5Just Joined!
- Join Date
- Jan 2011
- Posts
- 93
Tks. What means recursive? Little language barrier here.
Seems like most of the commands are rather natural so to learn and make the commands stick best for me to understand the linux-meaning of recursive.
Btw. If I at later time add a new folder with files from elsewhere on pc into "target_folder" which I have made myself owner of, will those new folder with files also have me as owner or do I have to make sure I do a new chown command every time?
- 02-09-2011 #6Just Joined!
- Join Date
- Nov 2010
- Posts
- 61
Recusrive mean that it will not only apply to the named folder but all sub-folders and files within it.
Its a common switch and can be used in many differnt commands like the commandwill remove the folder "folder1" and all files and subfolder inside it.Code:rm -Rf folder1


Reply With Quote
