LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   home directory specs (https://www.linuxquestions.org/questions/linux-newbie-8/home-directory-specs-815204/)

bluegospel 06-19-2010 07:32 PM

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?

keithieopia 06-19-2010 08:21 PM

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

bluegospel 06-19-2010 08:35 PM

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"?

keithieopia 06-19-2010 08:52 PM

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.

bluegospel 06-19-2010 09:04 PM

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?

PhoenixAndThor 06-19-2010 09:22 PM

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!

rkelsen 06-19-2010 09:36 PM

Quote:

Originally Posted by bluegospel (Post 4008981)
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.

jv2112 06-20-2010 07:53 AM

What should be in /etc/skel/ ?

Mine is empty :(

rkelsen 06-20-2010 08:08 AM

http://www.linfo.org/etc_skel.html

bluegospel 06-20-2010 11:34 AM

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.

jv2112 06-23-2010 05:26 PM

Thanks


All times are GMT -5. The time now is 08:49 PM.