Re: Username length limit?
> Daved Daly <daved.daly@gmail.com> [2004-06-03 12:47]:
>
> On Thu, 03 Jun 2004 12:13:08 +0200, Roel Schroeven
> <rschroev_nospam_ml@fastmail.fm> wrote:
> >
> > Hi,
> >
> > I'm trying to find out the maximum length of usernames on Linux
> > systems (Debian Woody specifically, but I guess it's the same
> > between different distros). Strangely enough, I can't find any
> > clear answer to my question.
> >
> > So I have two questions really: - what is the maximum length of
> > usernames (if any)?
>
> 8chars
>
well, it's been said quite often. But I doubt!
> > - where can I find authoritative documentation of such things?
>
> uh... uh... google? :P
man getpwent
The passwd structure is defined in <pwd.h> as follows:
struct passwd {
char *pw_name; /* user name */
char *pw_passwd; /* user password */
uid_t pw_uid; /* user id */
gid_t pw_gid; /* group id */
char *pw_gecos; /* real name */
char *pw_dir; /* home directory */
char *pw_shell; /* shell program */
};
So, there is no clear limit specified.
For the whole line length in passwd (I assume), you can find this
information in <pwd.h>.
# ifdef __USE_MISC
/* Reasonable value for the buffer sized used in the reentrant
functions below. But better use `sysconf'. */
# define NSS_BUFLEN_PASSWD 1024
# endif
but in google you can find recommendations not to exceed 16chars.
however, to be really safe and compatible with "older" software
make use of 8 characters only. For example, older Solaris versions
cause strange errors if you exceed.
wbr,
Lukas
--
Lukas Ruf | Wanna know anything about raw |
<http://www.lpr.ch> | IP? -> <http://www.rawip.org> |
eMail Style Guide: <http://www.rawip.org/style.html>|
Reply to: