change ownership of folder & its contents
I have been using linux for about a year now but recently did a new install. I opened a file manager as root and backed up all my important files and things like the hidden .mozilla & .thunderbird and such like folders so as i could keep my mail and news settings and accounts as well.
The only trouble is when i copy any folders into my my installation every folder & file has its ownership changed to root. This I'm sure is what is causing me a lot of permissions problems with these folders & files. It is a massive task to change all the ownerships of the files by selecting all the files in each folder and right clicking them to apply new ownership especially as right clicking the folder and applying new ownership doesn't change it on the files within the folder. how do I change the ownership of say the entire home directory and the files contained within its folders without having to deal with it one folder at a time. |
login as root, and use the console to navigate to the folder just above the one you want to change ownership for. Then use the following command:
Code:
chown <username> <folder path> |
In order to change permissions on all files within the directory it should have the -R switch.
Code:
chown -R user:group folder [edit] -R means recursive. man chown Reveals alot of information. |
thanks, I may need that myself later on!
|
So to make things easier if was in the home directory and typed
"chown -R user:group my-homefolder" would that set the permisions for everything in my home-folder and all the subfolders within and their files? |
Yes, that would change ownership on all files. example
Code:
#cd /home |
Sorry to be stupid but how do i find what group i am in?
|
you can type the groups command:
Code:
groups If you want to find out your primary group you use the id command Code:
id |
All times are GMT -5. The time now is 07:10 PM. |