useradd is unable to create home directory
When trying to create a new user (here for icinga, a nagios fork), with useradd -m, this fails to create the homedir. The user is created, however, but homedir creation and so on must be done manually.
root@openindiana:/usr/src/icinga-1.0.3# useradd -m icinga UX: useradd: ERROR: Unable to create the home directory: Operation not applicable. root@openindiana:/usr/src/icinga-1.0.3# grep icinga /etc/passwd icinga:x:102:1::/home/icinga:/bin/sh
Updated by Roy Sigurd Karlsbakk about 9 years ago
Seems this issue is related to auto_home somehow. When OI is installed, the initial user is created with home directory /export/home/username and added to /etc/auto_home. Adding a user with useradd -m will automatically try to create /home/username, which isn't allowed, since /home is just a mount point for auto_home. Manually creating /export/home/username, chmod'ing the dir and changing /etc/auto_home to * localhost:/export/home/& instead of username localhost:/export/home/& fixes this, but useradd -m really should work nevertheless.
Updated by Jeppe Toustrup about 9 years ago
This should perhaps be changed to set the default home directory for new users to be /export/home/<username> instead of /home/<username> and also the change you mention to /etc/auto_home.
A workaround would be to run "useradd -D -b /export/home" before creating the user, that will make the default home directory for the user /export/home/<username>, and then don't hit into the auto_home stuff.
Updated by Albert Lee about 9 years ago
- Status changed from New to In Progress
- % Done changed from 0 to 50
Patch guaranteed to make your eyes bleed, but it's merely in keeping with the spirit of the program:
With these changes, home directory creation on autofs will still fail at the chown step if there isn't an
* localhost:/export/home/&map or username specific map in auto_home.
This might be a duplicate of:
http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6436577 indicates that SMC was doing something similar.
See also the discussion for: https://defect.opensolaris.org/bz/show_bug.cgi?id=364