Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Change a users Home Directory

Posted on 2011-03-07
8
Medium Priority
?
918 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 12

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
Setting up LaraDock for Laravel

Learn how to set up LaraDock in a Laravel project - LaraDock gives us an easy way to run a Laravel application using Docker in a single command.

 
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 12

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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
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…
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.
Suggested Courses

719 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