V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
mrco
V2EX  ›  问与答

为什么 Linux 密码过期了,基于 key 的 ssh 也不能登录了?

  •  
  •   mrco · 2020-05-28 11:54:27 +08:00 · 1648 次点击
    这是一个创建于 1419 天前的主题,其中的信息可能已经有所发展或是发生改变。

    Hi *,

    因为等保关系,设置了密码的过期天数为 90,然后好多机器得密码都过期了,今天 ansible 去批量操作的时候提示:

        "changed": false,
        "msg": "Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in \"/tmp\". Failed command was: ( umask 77 && mkdir -p \"` echo /tmp/.ansible/tmp/ansible-tmp-1590631400.07-259586530289547 `\" && echo ansible-tmp-1590631400.07-259586530289547=\"` echo /tmp/.ansible/tmp/ansible-tmp-1590631400.07-259586530289547 `\" ), exited with result 1",
        "unreachable": true
    

    通过跳板机登录提示:

    You are required to change your password immediately (password aged)
    su: Authentication token is no longer valid; new one required
    (Ignored)
    

    我的疑问是为什么密码过期了 key 也不能 ssh 登录了? 我们不用密码登录,只用 key 登录,在符合等保要求的“设置密码过期天数”的情况下,应该怎么配置呢,谢谢大家!

    PS:系统为 ubuntu18.04

    4 条回复    2020-05-28 16:20:56 +08:00
    580a388da131
        1
    580a388da131  
       2020-05-28 15:18:17 +08:00 via iPhone
    密码过期后账户背禁用了呀
    到期前延长有效期呗
    BadAngel
        2
    BadAngel  
       2020-05-28 15:21:18 +08:00
    定时任务 推送新 Key 更新 Token
    580a388da131
        3
    580a388da131  
       2020-05-28 15:22:26 +08:00 via iPhone
    可以用 ansible 定期批量改密码 不是更安全么
    mrco
        4
    mrco  
    OP
       2020-05-28 16:20:56 +08:00
    @580a388da131 没错,但是我现在用于 ansible 的用户已经过期了,所以不能 ansible 批量了。

    还好初始化的时候预埋了一个超管账号
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5778 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 06:29 · PVG 14:29 · LAX 23:29 · JFK 02:29
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.