Solved

Change a users Home Directory

Posted on 2011-03-07
8
904 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
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 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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

785 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