What are the real rules for linux usernames on CentOS 6 and RHEL 6? [closed] What are the real rules for linux usernames on CentOS 6 and RHEL 6? [closed] linux linux

What are the real rules for linux usernames on CentOS 6 and RHEL 6? [closed]


A basic gnu/linux username is a 32 character string (useradd(8)). This is a legacy format from the BSD 4.3 standard. passwd(5) adds some additional restrictions like, do not use capital letters, do not use dots, do not end it in dash, it must not include colons.

To be on the safe side of things, follow the same rules of a C identifier:

([a-z_][a-z0-9_]{0,30})

That's half the problem. Modern GNU/Linux distributions use PAM for user authentication. With it you can choose any rule you want and also any data source.

Since you are writing a program it's better to define your own format, and then use something like pam_ldap, pam_mysql, etc. to access it.