LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Change ownership of an entire directory. (https://www.linuxquestions.org/questions/linux-newbie-8/change-ownership-of-an-entire-directory-817694/)

Shay 07-02-2010 03:08 PM

Change ownership of an entire directory.
 
Installed Sidux over Lenny

Sidux didn't want to take my usual username, because a folder with that name existed in my home directory.

So, I just mounted the home partition and changed the name of my home directory from shay to shay1.

Don't know what that did or didn't do permission wise to the files in my old home directory, but I've got a few unowned files floating around my home directory anyway that have been dragged in from old harddrives and such.

So, how do I "give" all of the files to user shay?

nuwen52 07-02-2010 03:20 PM

To change the ownerships of all files in a directory and it's subdirectories, do:
Code:

chown -R shay *
Now, if you want to change the group permissions at the same time to say, group users:
Code:

chown -R shay:users *
This will not to ".*" (dot files) in the same directory. Oh, you need to be root to do this, so either su to root, or run the chown in a sudo command.

Shay 07-02-2010 03:36 PM

Quote:

Originally Posted by nuwen52 (Post 4022098)
This will not to ".*" (dot files) in the same directory. Oh, you need to be root to do this, so either su to root, or run the chown in a sudo command.

Thanks. What if I do need to change ownership on dot files?

AnanthaP 07-02-2010 09:03 PM

dot files are not special types of files in linux. They are just hidden from `ls` without the -a option. Try `ls` and `ls -a` in a directory.

OK


All times are GMT -5. The time now is 09:16 AM.