LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 06-19-2010, 07:32 PM   #1
bluegospel
Member
 
Registered: Jan 2010
Distribution: centOS
Posts: 404

Rep: Reputation: 53
home directory specs


Hi. Is there anything special about a home directory before users' home directories are stored there, or is just as typical as any other "empty" folder?

Let me just cut to the chase, but please no ear ringing about the folly of messing around as root, particularly with directories at root level. I know it's considered stupidity, but I deleted my home directory.

Is there an easy way to restore a working home directory? I tried copying /etc/skel under root, but I'm not sure what a home directory should look like once it has been restored. Besides . & .., there were .screenrc & .xsession in my home directory when I copied /etc/skel. Are these files suppose to be in "/home" or "/home/~" or both?
 
Old 06-19-2010, 08:21 PM   #2
keithieopia
Member
 
Registered: Feb 2005
Posts: 69

Rep: Reputation: 18
First, /home contains all of the user's directories... as in there is a folder for each user corresponding with their username in /home. So my /home is really "/home/keithieopia" You shouldn't really need to copy anything from "/etc/skel" most Linux applications will create whatever file they need automatically in your home directory... but better safe that sorry.

So if your deleted your /home/USERNAME type the following commands as root to fix it (replace USERNAME with your actual username):
Quote:
mkdir /home/USERNAME
cp /etc/skel/* /home/USERNAME
chown USERNAME:USERNAME -R /home/USERNAME
chmod 750 -R /home/USERNAME
Then logout as root and login as the username you usually use. Everything should be fine. If not, post any errors you get here. A special note too, root lives in "/root" and not "/home/root"

So with your two files (most likely not needed) it would look like:
/home/USERNAME/.screenrc
/home/USERNAME/.xsession

Last edited by keithieopia; 06-19-2010 at 08:27 PM. Reason: Copy stuff from skel
 
Old 06-19-2010, 08:35 PM   #3
bluegospel
Member
 
Registered: Jan 2010
Distribution: centOS
Posts: 404

Original Poster
Rep: Reputation: 53
Actually, I didn't delete a user's directory in /home. I deleted /home. Can I just "mkdir /home" to restore it? Or was /home "special"?
 
Old 06-19-2010, 08:52 PM   #4
keithieopia
Member
 
Registered: Feb 2005
Posts: 69

Rep: Reputation: 18
Erm... if you deleted "/home" then everything under "/home" such as "/home/keithieopia" is also deleted. Did you do one of these: "rm -r"? If so, that's the case. You'll need to just "mkdir /home" before the rest of my instructions:

Quote:
mkdir /home
chmod 755 /home
mkdir /home/USERNAME
cp /etc/skel/* /home/USERNAME
chown USERNAME:USERNAME -R /home/USERNAME
chmod 750 -R /home/USERNAME
Or to directly answer your question, "/home" is just a folder with 755 permissions. However .xsession and .screenrc should not have been in the /home folder but a /home/USERNAME folder. Not sure why they were there.

Last edited by keithieopia; 06-19-2010 at 08:58 PM. Reason: screenrc in /home confusion
 
Old 06-19-2010, 09:04 PM   #5
bluegospel
Member
 
Registered: Jan 2010
Distribution: centOS
Posts: 404

Original Poster
Rep: Reputation: 53
Okay, now with an empty home directory, can I mount an ext3 or ext4 partition to /home and still use /home for users' home directories?
 
Old 06-19-2010, 09:22 PM   #6
PhoenixAndThor
Member
 
Registered: Sep 2009
Location: Geogia, USA
Distribution: Ubuntu, Debian, Live CDs
Posts: 213

Rep: Reputation: 39
It should be doable by messing around with you /etc/fstab file. Theoretically, in Linux, you can mount any drive partition to any empty folder. It all depends on exactly what you want to do with this, and the permissions you assign to both the folder you created and the partition to be mounted. Look up the 'mount' command (man -k mount or info mount) Hope you get your system back up and running!
 
Old 06-19-2010, 09:36 PM   #7
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,421
Blog Entries: 7

Rep: Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535
Quote:
Originally Posted by bluegospel View Post
Okay, now with an empty home directory, can I mount an ext3 or ext4 partition to /home and still use /home for users' home directories?
Yes.
 
Old 06-20-2010, 07:53 AM   #8
jv2112
Member
 
Registered: Jan 2009
Location: New England
Distribution: Arch Linux
Posts: 719

Rep: Reputation: 106Reputation: 106
Question

What should be in /etc/skel/ ?

Mine is empty
 
Old 06-20-2010, 08:08 AM   #9
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,421
Blog Entries: 7

Rep: Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535Reputation: 2535
http://www.linfo.org/etc_skel.html
 
Old 06-20-2010, 11:34 AM   #10
bluegospel
Member
 
Registered: Jan 2010
Distribution: centOS
Posts: 404

Original Poster
Rep: Reputation: 53
jv2112, it looks empty because some of the files are hidden. If you run "ls -a /etc/skel" or "ls -al /etc/skel" the -a option shows your hidden files.
 
Old 06-23-2010, 05:26 PM   #11
jv2112
Member
 
Registered: Jan 2009
Location: New England
Distribution: Arch Linux
Posts: 719

Rep: Reputation: 106Reputation: 106
Thanks
 
  


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
[SOLVED] 'Could not chdir to home directory /home/[user]: Permission denied' arashi256 Linux - Newbie 25 11-11-2011 09:29 AM
"Home directory already exists. Please enter another home directory path." Daravon Ubuntu 2 02-15-2009 10:26 PM
contents of 'home' directory found at sda5: mounted as /home, and also on sda6:/home leswatson Linux - Newbie 4 04-18-2008 04:02 PM
Apache Root/Home Directory and setting up FTP for home directories? Mankind75 Linux - Newbie 6 07-23-2006 02:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:02 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
Open Source Consulting | Domain Registration