adduser

2009-05-13 08:38:05来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

添加用户  
adduser命令使用配置文件/etc/adduser.conf来保存添加用户使用的缺省数据,如果没有
这个配置文件,第一次执行adduser时会询问缺省设置,以自动生成这个设置文件。这样对于很多基本一致的用户数据
就设置了正确的缺省值,以减少输入的工作量。
  # adduser
  Use option ``-silent'' if you don't want see all warnings & questions.
  Check /etc/shells
  Check /etc/master.passwd
  Check /etc/group
  Enter your default shell: bash csh date no sh [sh]:
  Your default shell is: sh -> /bin/sh
  Enter your default HOME partition: [/home]:
  Copy dotfiles from: /usr/share/skel no [/usr/share/skel]:
  Send message from file: /etc/adduser.message no
  [/etc/adduser.message]:
  Use passwords (y/n) [y]:
  Ok, let's go.
  在前面的过程中生成了配置文件之后,还可以使用编辑器来修改它的内容以更改adduser的配置。虽然生成了
配置文件,但每次启动adduser还会询问这些缺省参数是否需要更改,使得操作不太简便。为了让adduser直接
进入用户数据输入状态,可以使用 “adduser -quiet” 减少提示信息,-quiet的缩写方式为-q,
-silent和-s参数也有同样的效果。更一劳永逸的方式是直接修改adduser.conf文件,将其中的
verbose参数改为0,表示尽量减少提示。这个参数的缺省值为1,将进行设置缺省值的提示,而设置为2能提供更多的配置
参数。
  # adduser -s
  Use option ``-verbose'' if you want see more warnings & questions
  or try to repair bugs.
  Enter username [a-z0-9_-]: user22
  Enter full name []:
  Enter shell bash csh date no sh [sh]:
  Enter home directory (full path) [/home/user22]:
  Uid [1007]:
  Enter login class: default []:
  Login group user22 [user22]:
  Login group is ``user22''. Invite user22 into othergroups: guest no
  [no]:
  Enter password []:
  Use an empty password? (y/n) [y]:
  Name: user22
  Password: ****
  Fullname: user22
  Uid: 1007
  Gid: 1007 (user22)
  Class:
  Groups: user22
  HOME: /home/user22
  Shell: /bin/sh
  OK? (y/n) [y]:
  Added user ``user22''
  Send message to ``user22'' and: no root second_mail_address
  [no]:
  your account ``user22'' was created.
  Have fun!
  See also chpass(1), finger(1), passwd(1)
  Add anything to default message (y/n) [n]:
  Send message (y/n) [y]:
  Add another user? (y/n) [y]:n
  因此可以使用-s参数使adduser直接进入增加用户的操作步骤,这将询问增加用户的必要数据,包括用户名
、口令等数据。adduser将使用adduser.conf中的一些内容作为缺省提示,通常有提示的步骤可以直接利
用缺省提示进行操作。
用户组
用户组配置文件  /etc/group
用户除了属于passwd文件中定义的组之外,还可以被邀请进入其他组中。adduser添加用户时会
询问是否将用户加入其他组,如果在用户生成之后在将用户加入其他组,就需要直接改动/etc/group文件。例如
group文件中有这样一行:
  wheel:*:0:root,admin

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:[转]Screen 的用法!

下一篇:日常操作