LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How can i change my HOME (/home/user) directory location to something else? (https://www.linuxquestions.org/questions/linux-newbie-8/how-can-i-change-my-home-home-user-directory-location-to-something-else-824290/)

QueenZ 08-05-2010 02:39 AM

How can i change my HOME (/home/user) directory location to something else?
 
I have noticed that on a Mac which is Unix based too there is a different home directory which is NOT /home/user/ but /Users/user. How can I change my home directory in linux to something else? Even as an experiment? Is it possible? and how?

I'm using Ubuntu 10.04 GNOME

i92guboj 08-05-2010 02:43 AM

Quote:

Originally Posted by QueenZ (Post 4056452)
I have noticed that on a Mac which is Unix based too there is a different home directory which is NOT /home/user/ but /Users/user. How can I change my home directory in linux to something else? Even as an experiment? Is it possible? and how?

I'm using Ubuntu 10.04 GNOME

There are GUI tools to configure the users, passwords, home directories, shell of choice... Right now I don't remember the name for any of them.

The standard command line tool to modify the user properties would be usermod. You can as well edit /etc/passwd directly. That file has a manual page where you will find the meaning for each field. You can modify the home dirs there as well.

druuna 08-05-2010 03:55 AM

Hi,

First: Before you start fiddling with this make sure you have a working backup!!

This will move username's home to /New/Location, including all the files/directories that are present in username's current home directory (executed as user root):

usermod -m -d /New/Location username

The initial directory (/New in this example) must already exist before executing the usermod command.

Do take a look at man usermod for details.

Hope this helps.

QueenZ 08-05-2010 04:00 AM

Thanks that looks good, is there a way to make it so that when i create a new user, it's new path will automatically be /New/Location/username/... ?

druuna 08-05-2010 04:13 AM

Hi,

The defaults should reside in /etc/default/useradd (the HOME= entry).

BTW: /home/<user> is by convention..... It does happen occasionally that a user is appointed a different home directory (/home being different), it is not the way things are normally set up in linux. Depending on how other programs are (already) set up, you might run into problems. Be careful!

I would advise against changing the home location of all your users. But it is your box and you can do whatever you want.....

Hope this helps.

QueenZ 08-05-2010 04:25 AM

thanks, that's all i wanted to know :)

druuna 08-05-2010 06:26 AM

You're welcome :)


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