Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

First off I'm new to Linux. I have created a new user called "ginny" with -M option.

Now I'm trying to assign a home directory with usermod -d /link/to/directory ginny but it doesn't assign a home directory to user ginny.

% su - ginny returns an error
su: warning : cannot chance directory to /abc: No such file or directory

The pwd command returns /root for user ginny (maybe because i haven't created her a home directory) but is there any switch that can now allow me to assign a home directory to user ginny?

share|improve this question
it is small -m , you can check man useradd – Rahul Patil Apr 10 '13 at 8:31
I think you do not have any data in your home direcory, if so then try fresh using following: #userdel -r ginny #mkdir /abc #useradd -m /abc ginny;passwd ginny #chown -R ginny:ginny /abc – Tejas Apr 10 '13 at 9:45
@RahulPatil User ginny is already existing .......... – Gurbrinder Singh Apr 10 '13 at 15:16
you have to use -m at first time when you create user.. now you have to delete it and recreate it again using useradd -m ginny -d /abc no need to create /abc dir it will create it automatically with user ginny permission because of -m – Rahul Patil Apr 10 '13 at 18:24
up vote 0 down vote accepted

The user's home directory doesn't exist. usermod changes the home directory field in /etc/passwd but doesn't create the directory. You need to create it manually.

cp -a /etc/skel /link/to/directory          # or mkdir /link/to/directory to create an empty home directory
chown ginny:ginnygroup /link/to/directory   # where ginnygroup is ginny's primary group
chmod 755 /link/to/directory                # or 711 or 700 or 751 or 750 as desired
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.