Go Job Hunting at the LQ Job Marketplace
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 07-02-2010, 03:08 PM   #1
Registered: Sep 2003
Posts: 77

Rep: Reputation: 15
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?
Old 07-02-2010, 03:20 PM   #2
Registered: Feb 2009
Distribution: CentOS 5, Gentoo, FreeBSD, Fedora, Mint, Slackware64
Posts: 205

Rep: Reputation: 46
To change the ownerships of all files in a directory and it's subdirectories, do:
chown -R shay *
Now, if you want to change the group permissions at the same time to say, group users:
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.

Last edited by nuwen52; 07-02-2010 at 03:22 PM.
Old 07-02-2010, 03:36 PM   #3
Registered: Sep 2003
Posts: 77

Original Poster
Rep: Reputation: 15
Originally Posted by nuwen52 View Post
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?
Old 07-02-2010, 09:03 PM   #4
Registered: Jul 2004
Location: Chennai, India
Distribution: UBUNTU 5.10 since Jul-18,2006 on Intel 820 DC
Posts: 741

Rep: Reputation: 176Reputation: 176
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.



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
Changing ownership of an entire volume (Slack 12) LiquidCougar Linux - General 2 05-04-2008 09:28 AM
Creating script to change ownership directory on RHEL4U3 at startup Ferianto Linux - Enterprise 9 02-13-2008 10:01 PM
mount directory ownership shakezilla Slackware 3 01-23-2007 11:39 PM
ownership of directory lsu420luv Linux - General 1 06-09-2005 04:36 PM
change ownership Johng Linux - General 4 04-06-2004 02:24 AM

All times are GMT -5. The time now is 10:41 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration