Solved

Change a users Home Directory

Posted on 2011-03-07
8
900 Views
Last Modified: 2012-05-11
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
Comment
Question by:N R
  • 5
  • 2
8 Comments
 
LVL 31

Expert Comment

by:farzanj
ID: 35060457
usermod -d /home/userid userid
0
 
LVL 11

Author Comment

by:N R
ID: 35060470
I did that, but got this error bash: usermod: command not found.  Do I need to do it from a certain location?
0
 
LVL 31

Expert Comment

by:farzanj
ID: 35060486
Other easy way is to edit the /etc/passwd file

Manually change the user and change its home directory
0
 
LVL 6

Expert Comment

by:brb6708
ID: 35060489
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 31

Expert Comment

by:farzanj
ID: 35060493
You have to the root user to do so or you have to use sudo
0
 
LVL 11

Author Comment

by:N R
ID: 35060498
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
 
LVL 31

Accepted Solution

by:
farzanj earned 500 total points
ID: 35060523
/usr/sbin/usermod -d /home/userid userid
0
 
LVL 31

Expert Comment

by:farzanj
ID: 35060530
You became user by doing
su


You should have done
su -

Just guessing because your path is not set for root user
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now