Next: Changing user properties
Up: Creating a user
Previous: Initial environment: /etc/skel
按以下步骤手工创建新用户:
- 用vipw (8)编辑/etc/passwd ,
为新用户增加一个新行。注意语法。
不要用编辑器直接编辑! vipw 锁定了这个文件,其他命令这时不能更新它。
设定口令域为"*",这样不能登录。
- 类似,如果要创建新组,用vigr 编辑/etc/group 。
- 用mkdir 产生用户的家目录。
- 将/etc/skel 中的文件复制到新的家目录中。
- 用chown 和chmod 修改所有者和权限。
-R选项是最有用的。
The correct permissions vary a little from one site to another, but usually the following commands do the right thing:
cd /home/newusername
chown -R username.group .
chmod -R go=u,go-w .
chmod go= .
- 用passwd (1)设定口令。
最后一步设定完口令,这个帐户就能用了。不应该在其他所有事做完之前设定口令,否则这个用户可能不允许登录while you're still copying the files.
有时需要产生不为任何人使用的虚假(dummy)帐户
例如,建立一个匿名FTP服务器(这样任何人都可以从它下载文件,无须得到一个帐户),必须产生一个叫ftp的帐户。
这种情况,通常无须随后一步的口令设定。而且,最好不设,这样没有人可以使用这个帐户,除非先变成root,因为root可以变成任何用户。
Next: Changing user properties
Up: Creating a user
Previous: Initial environment: /etc/skel
Linux学院





Sun Jun 29 13:31:22 EEST 1997《Linux命令大全》 | 《Linux函数调用大全》 | 《Linux系统管理员手册》 | 中国存储网