2

Is it possible to create a user with username in Chinese or Japanese characters in Linux/Unix? I have tried creating a user with non-ASCII characters in the username in RedHat and the useradd command does not allow it. But I can create the user by directly copying such username in the /etc/passwd file. I am not sure if such usernames are even valid and would work with everything that needs a username. I have tried googling but haven't found a definitive answer. Kindly help.

Thanks

aks
  • 157
  • 9
  • Have you checked the question [Which code set is /etc/passwd stored in? Can it be UTF-8? What limits are placed on user names?](http://stackoverflow.com/questions/1412193/which-code-set-is-etc-passwd-stored-in-can-it-be-utf-8-what-limits-are-placed)? – VolenD Aug 16 '14 at 09:35
  • See http://unix.stackexchange.com – flup Aug 22 '14 at 22:03
  • @Vii If you managed to solve your issue its a good idea to accept one of the answers. This will help the community know that your question hasnt remained unsolved. – Vality Nov 25 '15 at 15:15

2 Answers2

7

These user-names are acceptable in modern Linux systems which are compiled with full Unicode support. This is an option which the distro designers choose when they compile the software for the distro, RedHat which is designed toward high stability and minimal features does not implement full Unicode support as it has not been carefully tested with all of the programs available.

However if you were to use a distro which does have unicode support you should be fine. Gentoo has unicode support these days as do several others. However I cannot guarantee that all tools will work bug-free with these user-names, particularly older ones which were not written with Unicode in mind.

This also relies on you having setup a locale on your system which supports those characters, these are usually the locales which are suffixed with .UTF-8 for example en_US.UTF-8.

You can find the system supported locales in /etc/locale.gen on many systems.

Vality
  • 6,577
  • 3
  • 27
  • 48
5

The POSIX standard says that user names should be restricted to the portable character set, which, very roughly speaking, is ASCII.

But apparently not all systems conform to the standard in that regard; on Debian for example, the low-level useradd(8) allows Unicode, but adduser(8) does not.

user2719058
  • 2,183
  • 11
  • 13