/etc/passwd存储在哪个代码集中?可以是UTF-8吗?对用户名有什么限制? [英] Which code set is /etc/passwd stored in? Can it be UTF-8? What limits are placed on user names?

查看:80
本文介绍了/etc/passwd存储在哪个代码集中?可以是UTF-8吗?对用户名有什么限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在现代的Unix或Linux系统上,如何分辨/etc/passwd文件中存储用户名的代码集?是否允许用户名包含带重音的字符(例如,在ISO 8859-1或8859-15中,范围为0x80..0xFF)? /etc/passwd文件可以包含UTF-8吗?您能说出它包含UTF-8吗?在密码被加密或散列之前,明文密码怎么办?

On a modern Unix or Linux system, how can you tell which code set the /etc/passwd file stores user names in? Are user names allowed to contain accented characters (from the range 0x80..0xFF in, say, ISO 8859-1 or 8859-15)? Can the /etc/passwd file contain UTF-8? Can you tell that it contains UTF-8? What about the plain text of passwords before they are encrypted or hashed?

很明显,如果用户名和其他数据限制在0x00..0x7F范围内(并且始终排除0x00),则UTF-8、8859-1或8859-15之间没有区别;出现的字符都采用相同的编码.

Clearly, if the usernames and other data is limited to the 0x00..0x7F range (and excludes 0x00 anyway), then there is no difference between UTF-8, 8859-1 or 8859-15; the characters present are all encoded the same.

此外,我将/etc/passwd用作基于Unix的机器上的用户标识和身份验证数据库(有时称为目录服务)的缩写,通常通过PAM访问,有时托管在其他计算机完全来自本地计算机,但有时实际上仍然是本地硬盘上的一个文件,通常称为/etc/passwd,通常受/etc/shadow支持."我还假设关于组数据库的等效问题(通常是/etc/group文件)具有相同的答案.

Also, I'm using /etc/passwd as an abbreviation for something along the lines of "the user identification and authentication database (sometimes termed a directory service) on a Unix-based machine, usually accessed via PAM and sometimes hosted on other machines altogether from the local one, but sometimes still actually a file on the local hard disk, conventionally called /etc/passwd, often supported by /etc/shadow". I'm also assuming that the equivalent questions about the group database (often the /etc/group file) have the same answer.

推荐答案

全部为ASCII.但是,密码本身从不存储-仅存储单向哈希的结果.如果您想知道密码本身中可以包含哪些字符,则取决于语言环境,这将限制您的终端能够处理的字符.参见人工语言环境"

It's all ASCII. But the password itself is never stored - only the results of the one-way hash. If you're wondering what characters can be in the password itself, it depends on the locale, which will restrict the characters your terminal is able to deal with. See "man locale"

在BSD手册页中:

"/etc/passwd ASCII密码文件..."

"/etc/passwd ASCII password file..."

对于用户名,我可以告诉您Solaris仅支持ASCII.我不能说其他的Unix-en.

As for usernames, I can tell you that Solaris only supports ASCII. I can't speak for other Unix-en.

并非Solaris 2和Solaris 7中的每个对象都可以具有由任意字符组成的名称.

"Not every object in Solaris 2 and Solaris 7can have names composed of arbitrary characters. The names of the following objects must be composed of ASCII characters:

* User names, group name, and passwords
* System name ...

"

这篇关于/etc/passwd存储在哪个代码集中?可以是UTF-8吗?对用户名有什么限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆