Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 927
  • Last Modified:

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?
0
Nathan Riley
Asked:
Nathan Riley
  • 5
  • 2
1 Solution
 
farzanjCommented:
usermod -d /home/userid userid
0
 
Nathan RileyFounderAuthor Commented:
I did that, but got this error bash: usermod: command not found.  Do I need to do it from a certain location?
0
 
farzanjCommented:
Other easy way is to edit the /etc/passwd file

Manually change the user and change its home directory
0
Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

 
brb6708Commented:
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
0
 
farzanjCommented:
You have to the root user to do so or you have to use sudo
0
 
Nathan RileyFounderAuthor Commented:
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
0
 
farzanjCommented:
/usr/sbin/usermod -d /home/userid userid
0
 
farzanjCommented:
You became user by doing
su


You should have done
su -

Just guessing because your path is not set for root user
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now