【问题标题】:Linux su passwordLinux su password
【发布时间】:2012-04-26 11:33:14
【问题描述】:

我想用 su 在一个命令行中更改用户

echo password | su user

但这不起作用。 还有其他可能吗? 最好的祝福

【问题讨论】:

    标签: linux passwords su


    【解决方案1】:

    首先:问问自己,脚本是否真的有必要知道密码。 sudo 和 SE-Linux 通常会为您提供很多选项来避免输入密码。

    这就是说,su 打开它的控制终端来读取密码,而不是标准输入。您可以使用 sudo-S 选项从标准输入读取密码。

    【讨论】:

      【解决方案2】:

      来自sudo的手册:

      -S
      
      The -S (stdin) option causes sudo to read the password from the standard input instead of the terminal device. The password must be followed by a newline character. 
      

      【讨论】:

        【解决方案3】:

        执行以下操作..

        密码根 它会要求您输入新密码 把它然后你以管理员身份登录并做你想做的事

        【讨论】:

          猜你喜欢
          • 2020-05-04
          • 1970-01-01
          • 1970-01-01
          • 2021-05-05
          • 2011-09-29
          • 2022-12-02
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多