Solved

Change a users Home Directory

Posted on 2011-03-07
8
907 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
[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: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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Advice on ESXi 5.1 Health / Storage 1 46
Let's Encrypt - Auto Renew Failure via Cron Job 1 28
regular expression help for sed command 5 41
Linux 3 36
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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…

733 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