linux 添加受限用户 SSH登录
来源:互联网 发布:幼儿园主题网络构图 编辑:程序博客网 时间:2024/04/30 03:16
[root@liugh ~]# useradd --helpUsage: useradd [options] LOGINOptions: -b, --base-dir BASE_DIR base directory for the new user account home directory -c, --comment COMMENT set the GECOS field for the new user account -d, --home-dir HOME_DIR home directory for the new user account -D, --defaults print or save modified default useradd configuration -e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE -f, --inactive INACTIVE set password inactive after expiration to INACTIVE -g, --gid GROUP force use GROUP for the new user account -G, --groups GROUPS list of supplementary groups for the new user account -h, --help display this help message and exit -k, --skel SKEL_DIR specify an alternative skel directory -K, --key KEY=VALUE overrides /etc/login.defs defaults -m, --create-home create home directory for the new user account -l, do not add user to lastlog database file -M, do not create user's home directory(overrides /etc/login.defs) -r, create system account -o, --non-unique allow create user with duplicate (non-unique) UID -p, --password PASSWORD use encrypted password for the new user account -s, --shell SHELL the login shell for the new user account -u, --uid UID force use the UID for the new user account -Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
实质还是Linux账户控制那一套东西。
1、登录 VPS
在终端应用程序上输入以下命令:
SSH root@94.249.184.93
记得将 "94.249.184.93" 替换成你 VPS 的 IP 地址。
2、创建一个用户组
输入以下命令:
groupadd internetfreedom
你可以将 "internetfreedom" 替换成任意名字。
3、创建受限用户
输入以下命令:
useradd -d /home/freenutsdotcom -m -g internetfreedom -s /bin/false freenutsdotcom
以上命令将会在 "internetfreedom" 创建一个新的 SSH 用户 "freenutsdotcom",该用户只能使用 SSH 代理,不能登录你的 VPS 帐户。
4、为新用户设置密码
输入以下命令:
passwd freenutsdotcom
然后,为该用户设置任意密码 (例如 "123456")。
完了之后,你就可以把该用户名和密码分享给朋友,他们也就可以通过以下命令使用你的 SSH 代理:
ssh -N -D 7070 freenutsdotcom@94.249.184.93
记得把 "freenutsdotcom" 替换成你新建的用户名,把 "94.249.184.93" 替换成你 VPS 的 IP 地址。
http://www.epooll.com/archives/642/
vps增加ssh账号用来代理上网,即开通没有shell权限的ssh帐号的方法:(说明:此账号没有ssh登陆权限)
——————————————-
useradd -M -s /sbin/nologin -n username //说明,username表示开通的ssh账号
passwd 用户名 //修改用户密码
userdel -r 用户名 //删除用户
——————————————-
操作实例演示:
比如要添加用户名为 ssh001 的账号,账号密码为:123 可以进行如下操作:
首先以root身份登录vps
[root@220.181.111.147]# useradd -M -s /sbin/nologin -n ssh001
[root@220.181.111.147]# passwd ssh001
Changing password for user ssh001
New UNIX password:123 (实际操作中,这里的密码是不会显示的)
Retype new UNIX password:123 (实际操作中,这里的密码是不会显示的)
passwd: all authenication tokens updated successfully.
http://sologuy.bizhijidi.com/175/
- linux 添加受限用户 SSH登录
- linux添加ssh用户
- linux添加ssh用户
- Linux SSH管理用户登录
- Linux SSH管理用户登录
- Linux SSH管理用户登录
- linux xshell5 ssh 证书远程登录配置、添加用户ssh配置
- linux中添加ssh用户
- linux 添加用户后ssh publickey登录 仍然需要密码debug
- linux下限制ssh登录用户
- Linux 限制root用户远程登录-ssh
- linux ssh登录及用户退出系统
- Linux结束其他ssh登录用户
- 制作 Linux ssh key文件登录,登录用户怎么设置
- 已添加另一台机器用户的ssh公钥,但登录仍需要密码---Linux报错
- ssh root用户登录
- linux中禁止root用户ssh远程登录并修改ssh远程登录端口
- linux下怎么查看ssh的用户登录日志
- Android 自定义控件实现刮刮卡效果
- 【ACMER纷纷表示】女生应该找一个玩ACM的男生
- Java8 Lamdba表达式 002
- 菜鸟nginx源码剖析数据结构篇(四)红黑树ngx_rbtree_t
- 一些问题的罗列以及解决
- linux 添加受限用户 SSH登录
- 七年IT工作经验的七个总结
- ubuntu12.04lts下安装python3
- Mac下的Sublime Text 3 安装go插件GoSublime, SideBarEnhancements,Go Build,Godef
- extern关键字
- ubuntu 14.10 安装配置minidlna
- 【并查集】【bzoj 1529】: [POI2005]ska Piggy banks
- 安全卫士第三天 四个界面
- 登入shell和非登入shell的区别