Bug #263
useradd is unable to create home directory
50%
Description
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
Related issues
Updated by Roy Sigurd Karlsbakk over 10 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.
roy
Updated by Jeppe Toustrup over 10 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 over 10 years ago
A nicer fix would be to teach useradd about autofs, although the extent to which you can actually do this is limited by access to automountd's internal state. A hack could be to prepend "/export" to a path if the filesystem is determined to be autofs.
Updated by Albert Lee over 10 years ago
- Assignee set to Albert Lee
- Target version set to oi_148
Working on it.
Updated by Albert Lee over 10 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:
http://pkgdev.openindiana.org/hg/onnv-gate/file/b23a4dab3d50/usr/src/cmd/oamuser/user/homedir.c
http://pkgdev.openindiana.org/hg/mq_onnv-gate/file/58e0a79afe38/oi-issue-263-useradd_homedir
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=6244467
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
Updated by Albert Lee about 10 years ago
- Status changed from In Progress to Resolved
Fixed in oi_148 along with its related bugs.