{ 11 comments… read them below or add one }

1 santhosh kumar theyyan May 6, 2008 at 12:25 pm

or specify the home with -d in useradd command

Reply

2 ashwani May 23, 2009 at 3:18 pm

Nice…info…but it doesnt work ;_( it still gives same error as before changeing in /etc/default/usradd

[root@localhost ~]# useradd -d /root/lvm/ mas
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.

Reply

3 Jay A June 18, 2009 at 10:24 am

Hi All,
Anyone who can teach me the solution for this problem:

I add a user jayabellon using this command:
useradd -u 888 -g oinstall -G dba -d /home/jayabellon -r jayabellon

i forgot to create home directory when I log-In so it prompts me cannot go to that directory.

I deleted the user and retry to create again.

But still, when I log-In, this is what it looks like:
-bash-3.00$

I am expecting it to be
[user@hostname]$

this is my entry in /etc/passwd:
jayabellon:x:888:501:jayabellon:/home/jayabellon:/bin/bash

actually, i am only working in a test server. Nothing much critical on this one.
It’s just that its my first time to create user using command line, because i usually do it in GUI based.

REgards,
Jay A

Reply

4 divyaraj February 16, 2012 at 7:23 am

Even I have the same problem. If you get any solution please mail me. One solution I can give that re-install the operating system,even I did the same.

Reply

5 Jay A June 18, 2009 at 10:27 am

-bash-3.00$ finger jayabellon
Login: jayabellon Name: jayabellon
Directory: /home/jayabellon Shell: /bin/bash
Never logged in.
No mail.
No Plan.

Reply

6 Vivek Gite June 18, 2009 at 11:10 am

Pass -m option to useradd command to create users home dir.

Reply

7 Jay A June 19, 2009 at 1:43 am

I got it.

it’s in man page also.

:D

found that it’s faster to create user in command line rather than using GUI Administration tool.

Thanks Vivek

Reply

8 Shash April 27, 2010 at 6:02 am

Any chance you can provide a similar command for Oracle SQL?

Reply

9 TonyRiver December 29, 2011 at 10:14 am

Thanks. I’ve been wondering how to change the default home directory for a while now. Glad I found this to explain how.
Your comment is awaiting moderation.

Reply

10 Tamjeed April 20, 2012 at 8:16 am

This is just nonsense of a blog, when the same thing can be achieved with usermod command with -d option to change the home directory.

Reply

11 Joey May 14, 2013 at 1:54 pm

It’s really not “nonsense of a blog.” The whole point is so that it is a default, so you DON’T have to do the -d option every time. Why make things harder on yourself? Set all the defaults in the config files, and then just useradd and be done with it.

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <kbd> <blockquote> <pre> <a href="" title="">

Tagged as: , , , , , , , , , ,

Previous Faq:

Next Faq: