I would like to know whether there is any simple shell command to change the user home directory in Linux/Unix (one similar to chsh which changes the default login shell of an existing valid user) without touching the /etc/passwd
file. Thanks
Ibrahim's comment on the other answer is the correct way to alter an existing user's home directory.
usermod -d /newhome/username username
usermod
is the command to edit an existing user.
-d
(abbreviation for --home
) will change the user's home directory.
usermod -m -d /newhome/username username
-m
(abbreviation for --move-home
) will move the content from the user's current directory to the new directory.