useradd warns on names with more than 8 chars
- useradd test567890
UX: useradd: test567890 name too long.
- cat /etc/passwd | grep test
the same problem with groupadd
Updated by Alexander Eremin over 9 years ago
8 chars is POSIX standard (POSIX_LOGIN_NAME_MAX in
Updated by Richard PALO over 9 years ago
from the comments in <limits.h>
LOGIN_NAME_MAX Maximum length of a login name. _Minimum_ Acceptable Value: _POSIX_LOGIN_NAME_MAX
btw, this is changing apparently in Solaris 11,
Updated by Gary Mills over 7 years ago
- Status changed from New to Feedback
- Assignee set to Gary Mills
- % Done changed from 0 to 80
I've modified this command so that it no longer issues a warning at 8 characters. Instead, it fails if the login name is longer than 32 characters:
# usr/src/cmd/oamuser/user/useradd aaaabbbbccccdddd # usr/src/cmd/oamuser/user/useradd aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbb # usr/src/cmd/oamuser/user/useradd aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbcccccccccccccccc UX: usr/src/cmd/oamuser/user/useradd: ERROR: aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbcccccccccccccccc is too long. Choose another.
We can't change LOGNAME_MAX because it's mandated by POSIX to have a value of 8 . We can, however, substitute LOGNAME_MAX_ILLUMOS, with value 32, in the affected source files. We can also define LOGIN_NAME_MAX, which is the buffer size including the terminating NUL character, as long as its value is larger than 9 . I've defined it to be LOGNAME_MAX_ILLUMOS + 1 for these source changes.