知行社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

知行社区 门户 技术 查看内容

VPS添加受限账户

2012-9-11 19:15| 发布者: 知行| 查看: 396| 评论: 1|原作者: 知行

摘要: 创建用户组: groupadd usergroup 创建受限用户 输入以下命令: useradd -d /home/user -m -g usergroup -s /bin/false user 以上命令将会在 “usergroup” 创建一个新的 SSH 用户 “user”,该用户只能 ...
创建用户组:
groupadd usergroup

创建受限用户

输入以下命令:

useradd -d /home/user -m -g usergroup -s /bin/false user

以上命令将会在 “usergroup” 创建一个新的 SSH 用户 “user”,该用户只能使用 SSH 代理,不能登录你的 VPS 帐户。
以上命令选项的意义: -d 新账户的主目录,-m 创建用户目录 ,-g 新用户所属用户组,-s 新账户的shell权限
  1. Usage: useradd [options] LOGIN

  2. Options:
  3.   -b, --base-dir BASE_DIR       base directory for the home directory of the
  4.                                 new account
  5.   -c, --comment COMMENT         GECOS field of the new account
  6.   -d, --home-dir HOME_DIR       home directory of the new account
  7.   -D, --defaults                print or change default useradd configuration
  8.   -e, --expiredate EXPIRE_DATE  expiration date of the new account
  9.   -f, --inactive INACTIVE       password inactivity period of the new account
  10.   -g, --gid GROUP               name or ID of the primary group of the new
  11.                                 account
  12.   -G, --groups GROUPS           list of supplementary groups of the new
  13.                                 account
  14.   -h, --help                    display this help message and exit
  15.   -k, --skel SKEL_DIR           use this alternative skeleton directory
  16.   -K, --key KEY=VALUE           override /etc/login.defs defaults
  17.   -l, --no-log-init             do not add the user to the lastlog and
  18.                                 faillog databases
  19.   -m, --create-home             create the user's home directory
  20.   -M, --no-create-home          do not create the user's home directory
  21.   -N, --no-user-group           do not create a group with the same name as
  22.                                 the user
  23.   -o, --non-unique              allow to create users with duplicate
  24.                                 (non-unique) UID
  25.   -p, --password PASSWORD       encrypted password of the new account
  26.   -r, --system                  create a system account
  27.   -s, --shell SHELL             login shell of the new account
  28.   -u, --uid UID                 user ID of the new account
  29.   -U, --user-group              create a group with the same name as the user
  30.   -Z, --selinux-user SEUSER     use a specific SEUSER for the SELinux user mapping

复制代码

鲜花

握手

雷人

路过

鸡蛋
发表评论

最新评论

知行 2012-9-7 22:17
/bin/false:不允许用户登陆系统

查看全部评论(1)

相关分类



QQ|小黑屋|手机版|知行技术社区 ( 湘ICP备11020288号-1 )

GMT+8, 2020-4-5 11:05 , Processed in 0.016598 second(s), 12 queries , Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

返回顶部