On Wed, 3 Feb 1999, Trevor Reynolds wrote:
>Is there a "true" limit on the length of a Userid in linux?

In UNIX, there is no formal maximum for the length of a userid, although it is
guaranteed to be no less than 8. You can ask your system what its maximum is by
compiling and running the following program:

   #include <stdlib.h>
   #include <unistd.h>
   #include <stdio.h>
   int main (int argc, char **argv) {
      printf("%d\n", sysconf(_SC_LOGIN_NAME_MAX));
      return 0;
   }

On my system, for example, this program prints 9, which, allowing for a
trailing null byte, means that my maximum userid length is 8.

Even if your system allows for a longer userid, it's still best not to exceed 8
as some old mailers have trouble with userids which are longer than that.

>but some interfaces,
>like webmin, will let you add users with as many characters as you want,

Technically, userids can be longer than the maximum, but the extra characters
are not significant. Also, since some programs may use SYSCONF to determine how
large to allocate a buffer, having userids which are too long could cause
buffer overruns.

-- 
Dave Mielke           | 856 Grenon Avenue | I believe that the Bible is the
Phone: 1-613-726-0014 | Ottawa, Ontario   | Word of God. Please contact me
EMail: [EMAIL PROTECTED] | Canada  K2B 6G3   | if you're concerned about Hell.

Reply via email to