LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 07-11-2007, 08:05 AM   #1
roadrash
LQ Newbie
 
Registered: Jan 2007
Location: Huntingdon, U.K.
Distribution: Ubuntu, Mint
Posts: 23

Rep: Reputation: 0
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.
 
Old 07-11-2007, 08:11 AM   #2
pplude92
LQ Newbie
 
Registered: Jul 2007
Distribution: Debain 4.0 "Etch"
Posts: 15

Rep: Reputation: 0
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>
As far as I remember this applies to the files in the folder also.
 
Old 07-11-2007, 08:15 AM   #3
lord-fu
Member
 
Registered: Apr 2005
Location: Ohio
Distribution: Slackware && freeBSD
Posts: 676

Rep: Reputation: 30
In order to change permissions on all files within the directory it should have the -R switch.

Code:
chown -R user:group folder
Hope it helps some.

[edit] -R means recursive.
man chown

Reveals alot of information.

Last edited by lord-fu; 07-11-2007 at 08:22 AM.
 
Old 07-11-2007, 08:16 AM   #4
pplude92
LQ Newbie
 
Registered: Jul 2007
Distribution: Debain 4.0 "Etch"
Posts: 15

Rep: Reputation: 0
thanks, I may need that myself later on!
 
Old 07-11-2007, 09:29 AM   #5
roadrash
LQ Newbie
 
Registered: Jan 2007
Location: Huntingdon, U.K.
Distribution: Ubuntu, Mint
Posts: 23

Original Poster
Rep: Reputation: 0
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?

Last edited by roadrash; 07-11-2007 at 09:31 AM.
 
Old 07-11-2007, 09:33 AM   #6
lord-fu
Member
 
Registered: Apr 2005
Location: Ohio
Distribution: Slackware && freeBSD
Posts: 676

Rep: Reputation: 30
Yes, that would change ownership on all files. example

Code:
#cd /home
#chown -R me:wheel me
 
Old 07-11-2007, 10:00 AM   #7
roadrash
LQ Newbie
 
Registered: Jan 2007
Location: Huntingdon, U.K.
Distribution: Ubuntu, Mint
Posts: 23

Original Poster
Rep: Reputation: 0
Sorry to be stupid but how do i find what group i am in?
 
Old 07-11-2007, 10:07 AM   #8
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,975
Blog Entries: 1

Rep: Reputation: 208Reputation: 208Reputation: 208
you can type the groups command:

Code:
groups
That will tell you what groups you belong to.

If you want to find out your primary group you use the id command

Code:
id

Last edited by custangro; 07-11-2007 at 10:09 AM.
 
  


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
Is there a command that gives you ownership of a folder and all it's sub-folders royeo Linux - Newbie 3 06-01-2007 01:55 PM
compare folder contents babysnake Linux - Newbie 4 02-09-2007 07:04 AM
Unlock folder (drive) & change permissions VIR3NT SUSE / openSUSE 5 05-27-2006 06:37 PM
Website Hosting and file/folder ownership vbfischer Linux - Security 2 07-01-2004 12:31 PM
Cannot see contents of my folder nr4g3d Linux - Newbie 6 02-09-2004 03:01 PM


All times are GMT -5. The time now is 12:53 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration