网上的方式,都是去 vi /etc/passwd,找到那个用户,然后去修改它的 shell 是 bash、还是 /sbin/nologin,我是 root 的话,是否简便的命令行修改方式,重新定义指定用户的登录环境呢?
用 sed ?
usermod -s 默认 shell 路径 用户名
chsh -s /bin/bash
不知道在网上是怎么找的
不知道你是怎么在网上找的
chsh 这是基础吧,兄弟
正确答案,感谢~
@EricXuu,你确认这命令能改其它用户的 shell ?
su - aaa - c chsh ...... 这种呢?
chsh 有个可选的参数是 username
chsh -s path/to/shell user
root 下可以直接 chsh +用户名来修改
➜ ~ chsh mldonkey
Changing the login shell for mldonkey
Enter the new value, or press ENTER for the default
Login Shell [/bin/false]:
是我自己疏忽,现在才有条件测试,chsh 确实可行
而自己又没测试过,确实不知道。
楼主先看一下鸟哥吧
话说,chsh、自己手动改都不能 check 对应的 shell 是否可用,这会有个大坑:
如果 shell 不可用,然后已经退出了远超登录。那么恭喜,你再也登录不上这台 vps 了。