多数Linux distributions有产生帐号的程序,而且有多个。 adduser 和useradd 是其中2个;可能还有GUI的工具。 Whatever the program, the result is that there is little if any manual work to be done. Even if the details are many and intricate, these programs make everything seem trivial. However, section 8.2.4 describes how to do it by hand.
许多Linux系统有影子口令shadow passwords文件。这种方法将加密的口令存在另一个文件/etc/shadow 中,而这个文件只有root能读。 /etc/passwd 文件在第二个域只有一个special marker。 Any program that needs to verify a user is setuid,那么可以存取影子口令文件。而只使用口令文件其他域的普通程序,不能得到口令。 取得数字的用户和组ID
然而,通常最好保持/etc/skel 尽量小,因为it will be next to impossible to update existing users' files. 例如,如果友善的编辑器的名字改变了,所有现存用户必须编辑他们的.profile 。系统管理员可以用一个script自动完成,但仍可能破坏某个用户的文件。
用chown 和chmod 修改所有者和权限。 -R选项是最有用的。 The correct permissions vary a little from one site to another, but usually the following commands do the right thing:
也可以改变用户名或口令,但这样用户不知道怎么回事。 Confused users mean more work.
产生上述特定程序的一个简单方法是写"tail scripts":
#!/usr/bin/tail +2 This account has been closed due to a security breach. Please call 555-1234 and wait for the men in black to arrive. 前2个字符("#!")告诉核心本行的其他部分是解释本文件要运行的命令。这样tail 命令将输出处理第一行外的所有东西到标准输出。 如果怀疑billg是个安全缺口,系统管理员可以这样做:
# chsh -s /usr/local/lib/no-login/security billg # su - tester This account has been closed due to a security breach. Please call 555-1234 and wait for the men in black to arrive. # su 的目的是此时改变是否工作。 Tail scripts应该放在一个分离的目录中,这样它们的名字不会干扰普通用户的命令