Link to home
Start Free TrialLog in
Avatar of Nathan Riley
Nathan RileyFlag for United States of America

asked on

Change a users Home Directory

I'm on CENTOS and trying to change an existing user's home directory.  I tried usermod, but says that command is bad.  Any other way?
Avatar of farzanj
Flag of Canada image

usermod -d /home/userid userid
Avatar of Nathan Riley


I did that, but got this error bash: usermod: command not found.  Do I need to do it from a certain location?
Other easy way is to edit the /etc/passwd file

Manually change the user and change its home directory
Easy: As root edit /etc/passwd using texteditor and modify Field No 6.
Fields are separated by colon (:)
Entry loks like
You have to the root user to do so or you have to use sudo
heh, tried that before and had some major issues after the edit, would like to do using usermod,  I am logged in as root, but still getting the error: error bash: usermod: command not found
Avatar of farzanj
Flag of Canada image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You became user by doing

You should have done
su -

Just guessing because your path is not set for root user