ubuntu 建立了一个 nologin 的账户,真的就 login 不了了,求破解。

2014-07-21 21:40:34 +08:00
 nihaov
ubuntu12.04
这样添加的用户 useradd -M -s /sbin/nologin tooth

之后用bitvise ssh 连接的时候,让我不停地输入密码,下边提示

20:29:08.694 Host key added successfully.
20:29:08.710 First key exchange completed.
20:29:08.710 Key exchange: diffie-hellman-group14-sha1. Session encryption: aes256-ctr, MAC: hmac-sha1, compression: none.
20:29:08.929 Attempting 'password' authentication.
20:29:11.226 Authentication failed. Remaining authentication methods: 'publickey,password'.
20:29:12.539 Session terminated on user's request.



但是用root登录没有这个问题,因为什么原因呢。求解答!谢谢!
8505 次点击
所在节点    Ubuntu
9 条回复
suifengdaren
2014-07-21 22:37:46 +08:00
去看看/etc/passwd吧,里面有你用户名那条记录把/sbin/nologin改成/bin/bash
sandtears
2014-07-21 22:43:40 +08:00
nologin 本来就是让你不能登陆的用户。ssh 的话只支持通过 -R, -L, -D 转发,不支持登录。
root 没有这个问题是因为你没有修改 root 的登录 shell 为 nologin
sixteen
2014-07-21 23:33:00 +08:00
su tooth --shell=/bin/bash
sixteen
2014-07-21 23:34:28 +08:00
如果用作ssh转发的话可以把shell设置为/bin/false
tonyluj
2014-07-22 00:42:25 +08:00
#chsh tooth -s /bin/bash
zzutmebwd
2014-07-22 00:53:50 +08:00
问一个nologin用户为什么不能login...你在逗我?
sandtears
2014-07-22 08:40:43 +08:00
我明白你的意思了,你就是想用来做 ssh 转发是吧。

ubuntu 下对应的 shell 应该是 `/bin/false`, CentOS 才是 `/sbin/nologin`
limuxy
2014-07-22 08:56:54 +08:00
楼主为什么不把问题说清楚呢 『然后做那个啥用』…… 囧
nihaov
2014-07-22 09:51:24 +08:00
呵呵,明白了。
原来我把centos的放到ubuntu上了
@sandtears @sixteen 你们懂我!
然后感谢大家的讲解。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/123803

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX