Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Home Directory Ubuntu 14.10 [closed]

I'm trying to change the home directory to a different folder and my OS is not letting me do that. In Ubuntu I try to edit the useradd file but I can't figure out any way to save my changes that I made. Does anyone know how to do this?

like image 619
Christian Kramer Avatar asked Feb 20 '15 00:02

Christian Kramer


People also ask

How do I change the default home directory in Ubuntu?

You can use the usermod command to change the default home directory for a user. What this command does is edit the file /etc/passwd. Opening /etc/passwd you will find there is a line for every user, including system users (mysql, posftix, etc), with seven fields per line denoted by colons.

How do I go back to home directory?

You can return to your home directory from anywhere in the directory structure by typing cd on its own. Remember to include the dollar sign in the command line: without it, the echo(C) command will simply return the word ``HOME''.


2 Answers

As root

usermod -d /path/to/new/directory username

Make sure your have created the new directory first with the mkdir command. Then login as yourself again, the directory is set during login.

like image 149
jim mcnamara Avatar answered Oct 11 '22 21:10

jim mcnamara


sudo usermod -d /path/to/new/home -m username
like image 45
TEDDY Avatar answered Oct 11 '22 21:10

TEDDY