Linux su密码
我想用su在一个命令行中更改用户Linux su密码,linux,passwords,su,Linux,Passwords,Su,我想用su在一个命令行中更改用户 echo password | su user 但这是行不通的。 还有其他可能性吗? 最美好的祝愿做以下事情 密码根 它将要求您输入新密码 放置它,然后以管理员身份登录并执行所需操作执行以下操作 密码根 它将要求您输入新密码 把它放进去,然后以管理员身份登录,然后做你想做的事情首先:问问自己脚本是否真的需要知道密码sudo和SE Linux通常为您提供大量避免输入密码的选项 这就是说,su打开其控制终端读取密码,而不是stdin。您可以使用sudo和-S选项从
echo password | su user
但这是行不通的。
还有其他可能性吗?
最美好的祝愿做以下事情
密码根
它将要求您输入新密码
放置它,然后以管理员身份登录并执行所需操作执行以下操作
密码根
它将要求您输入新密码
把它放进去,然后以管理员身份登录,然后做你想做的事情首先:问问自己脚本是否真的需要知道密码
sudo
和SE Linux通常为您提供大量避免输入密码的选项
这就是说,
su
打开其控制终端读取密码,而不是stdin。您可以使用sudo
和-S
选项从stdin读取密码。首先:问问自己脚本是否真的需要知道密码sudo
和SE Linux通常为您提供大量避免输入密码的选项
这就是说,
su
打开其控制终端读取密码,而不是stdin。您可以使用sudo
和-S
选项从stdin读取密码。来自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.
从
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.