Solved

Change a users Home Directory

Posted on 2011-03-07
8
913 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:Nathan Riley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 31

Expert Comment

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

Author Comment

by:Nathan Riley
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
RHCE - Red Hat OpenStack Prep Course

This course will provide in-depth training so that students who currently hold the EX200 & EX210 certifications can sit for the EX310 exam. Students will learn how to deploy & manage a full Red Hat environment with Ceph block storage, & integrate Ceph into other OpenStack service

 
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
 
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:Nathan Riley
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

A new era in Cloud training has arrived.

A day that will go down in Cloud history.. But are you ready for it? Will you accept this Cloud challenge?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

617 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