V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
nihaov
V2EX  ›  Ubuntu

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

  •  
  •   nihaov · 2014-07-21 21:40:34 +08:00 · 8496 次点击
    这是一个创建于 3564 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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登录没有这个问题,因为什么原因呢。求解答!谢谢!
    第 1 条附言  ·  2014-07-22 08:37:12 +08:00
    CentOS可以这么添加一个用户,然后做那个啥用。
    我记得Ubuntu原来也这么弄的。
    网上搜索最小权限的账户也是这么建立的。 为什么呢
    跟什么软件有冲突?
    9 条回复    2014-07-22 09:51:24 +08:00
    suifengdaren
        1
    suifengdaren  
       2014-07-21 22:37:46 +08:00
    去看看/etc/passwd吧,里面有你用户名那条记录把/sbin/nologin改成/bin/bash
    sandtears
        2
    sandtears  
       2014-07-21 22:43:40 +08:00
    nologin 本来就是让你不能登陆的用户。ssh 的话只支持通过 -R, -L, -D 转发,不支持登录。
    root 没有这个问题是因为你没有修改 root 的登录 shell 为 nologin
    sixteen
        3
    sixteen  
       2014-07-21 23:33:00 +08:00
    su tooth --shell=/bin/bash
    sixteen
        4
    sixteen  
       2014-07-21 23:34:28 +08:00   ❤️ 1
    如果用作ssh转发的话可以把shell设置为/bin/false
    tonyluj
        5
    tonyluj  
       2014-07-22 00:42:25 +08:00
    #chsh tooth -s /bin/bash
    zzutmebwd
        6
    zzutmebwd  
       2014-07-22 00:53:50 +08:00 via Android
    问一个nologin用户为什么不能login...你在逗我?
    sandtears
        7
    sandtears  
       2014-07-22 08:40:43 +08:00   ❤️ 1
    我明白你的意思了,你就是想用来做 ssh 转发是吧。

    ubuntu 下对应的 shell 应该是 `/bin/false`, CentOS 才是 `/sbin/nologin`
    limuxy
        8
    limuxy  
       2014-07-22 08:56:54 +08:00
    楼主为什么不把问题说清楚呢 『然后做那个啥用』…… 囧
    nihaov
        9
    nihaov  
    OP
       2014-07-22 09:51:24 +08:00
    呵呵,明白了。
    原来我把centos的放到ubuntu上了
    @sandtears @sixteen 你们懂我!
    然后感谢大家的讲解。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1030 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 22:13 · PVG 06:13 · LAX 15:13 · JFK 18:13
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.