LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Creating a new user in a mount point other than / (https://www.linuxquestions.org/questions/linux-newbie-8/creating-a-new-user-in-a-mount-point-other-than-839253/)

rajesh_bu2001 10-20-2010 07:17 AM

Creating a new user in a mount point other than /
 
Hi Friends,
In my machine, there are 2 mount points - / and /userdata. From the root user, I want to create an oracle user at the /userdata mount point, i.e the home of the oracle user should be mounted on /userdata. Is it possible, if yes then pls guide me for the same.

Thanks in Advance,
Rajesh

Sayan Acharjee 10-20-2010 07:19 AM

Quote:

Originally Posted by rajesh_bu2001 (Post 4133430)
Hi Friends,
In my machine, there are 2 mount points - / and /userdata. From the root user, I want to create an oracle user at the /userdata mount point, i.e the home of the oracle user should be mounted on /userdata. Is it possible, if yes then pls guide me for the same.

Thanks in Advance,
Rajesh

Yes its possible, you can use -d option to achieve that.

Quote:

#useradd -d /userdata/oracle oracle

TB0ne 10-20-2010 07:36 AM

Quote:

Originally Posted by sayan_acharjee (Post 4133434)
Yes its possible, you can use -d option to achieve that.

Uhh...no. Read the man page for useradd. The "-d" option SPECIFIES the directory to use for the new user. The "-m" option creates it.

Sayan Acharjee 10-20-2010 07:40 AM

Quote:

Originally Posted by TB0ne (Post 4133457)
Uhh...no. Read the man page for useradd. The "-d" option SPECIFIES the directory to use for the new user. The "-m" option creates it.

Well, if it is linux then -m option is not really required, the directory will be created automatically. Just using the -d option will specify where to create the home directory. And ya I agree, -d option doesn't create directory, it only specifies its location, thanks for pointing that out.
And again if I've posted something wrong here, please let me know. :)

rajesh_bu2001 10-20-2010 08:31 AM

Thanks a lot Sayan!!!

Sayan Acharjee 10-20-2010 08:40 AM

Quote:

Originally Posted by rajesh_bu2001 (Post 4133523)
Thanks a lot Sayan!!!

Most welcome :)
Don't forget to mark the thread as solved.

TB0ne 10-20-2010 08:50 AM

Quote:

Originally Posted by sayan_acharjee (Post 4133470)
Well, if it is linux then -m option is not really required, the directory will be created automatically. Just using the -d option will specify where to create the home directory. And ya I agree, -d option doesn't create directory, it only specifies its location, thanks for pointing that out.
And again if I've posted something wrong here, please let me know. :)

No, sorry.

The -d option says what directory TO use. -m option says to create it. From the man page:
Quote:

-d, --home homedir
This option specifies the users home directory. If not specified, the default from /etc/default/useradd is used.
-m, --create-home
Create home directory for new user account.
Just specifying the -d option does NOT automatically create a home directory. On some versions of Linux, depending on how it's set up, it may create a directory. The -m option specifically tells it to. Again, -d will create it wherever the DEFAULT home directory space is, so if it's /home, it'll get created there, unless you specify differently, which is what the OP asked for.

Sayan Acharjee 10-20-2010 08:54 AM

Quote:

Originally Posted by TB0ne (Post 4133545)
No, sorry.

The -d option says what directory TO use. -m option says to create it. From the man page:

Just specifying the -d option does NOT automatically create a home directory. On some versions of Linux, depending on how it's set up, it may create a directory. The -m option specifically tells it to. Again, -d will create it wherever the DEFAULT home directory space is, so if it's /home, it'll get created there, unless you specify differently, which is what the OP asked for.

Fair enough, thanks ;)


All times are GMT -5. The time now is 12:02 AM.