Avatar of Nathan Riley
Nathan Riley
Flag 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?
Linux OS DevLinuxLinux Distributions

Avatar of undefined
Last Comment
farzanj

8/22/2022 - Mon
farzanj

usermod -d /home/userid userid
Nathan Riley

ASKER
I did that, but got this error bash: usermod: command not found.  Do I need to do it from a certain location?
farzanj

Other easy way is to edit the /etc/passwd file

Manually change the user and change its home directory
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Bernie Bsen

Easy: As root edit /etc/passwd using texteditor and modify Field No 6.
Fields are separated by colon (:)
Entry loks like
username:x:uid:gid:Comment:/home/username:/bin/bash
farzanj

You have to the root user to do so or you have to use sudo
Nathan Riley

ASKER
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
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
farzanj

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
farzanj

You became user by doing
su


You should have done
su -

Just guessing because your path is not set for root user