LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Solaris / OpenSolaris (http://www.linuxquestions.org/questions/solaris-opensolaris-20/)
-   -   Adding User in Solaris Error..... (http://www.linuxquestions.org/questions/solaris-opensolaris-20/adding-user-in-solaris-error-4175448222/)

manalisharmabe 02-01-2013 02:48 PM

Adding User in Solaris Error.....
 
Hi all,

when I type this command

Code:
useradd -d /home/ram89 -m ram89


it gives an error unable to create home directory.

Why so ?

How to create user in Solaris?

The perfect method?

Please guide me.

Thanks in advance

Manali.

TB0ne 02-01-2013 03:05 PM

Quote:

Originally Posted by manalisharmabe (Post 4882538)
Hi all,
when I type this command

Code:
useradd -d /home/ram89 -m ram89

it gives an error unable to create home directory. Why so ? How to create user in Solaris? The perfect method?

You don't give any details (version of Solaris? Running this as root? SUDO? Does the directory already EXIST? Using LDAP/NIS?), so it's hard to say. It's either a permissions issue, the directory exists, the /home partition isn't present (or writable), or you're not putting the command in correctly.

If you want a 'perfect method', then read the man page on the useradd command.
http://www.tech-recipes.com/rx/16/ad...ne-in-solaris/

manalisharmabe 02-01-2013 03:18 PM

Solaris 10
running as root
/home exit

shivaa 02-01-2013 09:09 PM

By default /home directory has root:root as owner and do not has write permission for group or other.
Code:

# ls -ld /home
drwxr-xr-x  37 root    root        1024 Jul 17  2012 /home

In your case, perhaps you're not login as root, so you do not have write permission in /home and you cannot create a home directory for new user. Therefore it's throwing error.

In order to do it successfully, switch to root user.

---- ADD ----
Also if you are already running as root, then there's probability that /home isn't there or not mounted. Instead in Solaris 10, you will find /export/home mount point for home directories.
So you can check and try like:
Code:

~# ls -ld /home
~# ls -ld /export/home
~# df -k /home /export/home

~# useradd -d /export/home/ram89 -m ram89


TB0ne 02-02-2013 10:33 AM

Quote:

Originally Posted by manalisharmabe (Post 4882557)
Solaris 10
running as root
/home exit

No idea what you mean by "/home exit". And you were provided a link with some things to try...did you? If you're not going to provide any more information, there's little incentive for us to help, if we've got to try to pull things out of you.

AGAIN:
  • Are you logged in as root?
  • Did you SU to root?
  • Did you use SUDO to get to a root shell?
  • Did you use SUDO to run the command?
  • Does the directory already EXIST?
  • Using LDAP/NIS?
  • Does the /home directory even EXIST?
  • Is the /home partition mounted?
  • Is the /home partition read/write, or read-only?

Blinker_Fluid 02-02-2013 09:50 PM

Solaris uses /export/home normally, while it is possible to use just /home there are other things you have to do first. Quick and dirty you can manually create the home dir and leave off the -m then change ownership after creation.

jlliagre 02-03-2013 02:00 PM

Quote:

Originally Posted by manalisharmabe (Post 4882538)
when I type this command
Code:

useradd -d /home/ram89 -m ram89
it gives an error unable to create home directory.
Why so ?

Because /home is managed by the automounter by default under Solaris.
Quote:

How to create user in Solaris?
The perfect method?
There is no "perfect method". There are various methods that better suit various needs.
Quote:

Please guide me.
In your case, the simplest would be to disable /home specific handling by commenting out (or removing) the line about it in the /etc/auto_master file
Code:

# /home        auto_home
and then restart autofs:
Code:

svcadm restart autofs

manalisharmabe 02-07-2013 01:38 PM

Thanks all,

It is solved now.


All times are GMT -5. The time now is 09:26 AM.