shell普通用户提升权限非交互式嵌套修改root密码
2024-08-08 / shell / 86 次围观 / 0 次吐槽 /echo "$root_passwd" | su -c "echo '$new_root_passwd' | passwd --stdin root" echo "$weihu_passwd" | sudo -S bash -c "echo '$new_root_passwd' | passwd --stdin root"
其他方法参考:
newpasswd=bm4A3X@e encrypted_passwd=$(openssl passwd -1 "$newpasswd") usermod -p "$encrypted_passwd" root
[root@localhost ~]# passwd root << EOF > passwd > passwd > EOF Changing password for user root. New password: Retype new password: passwd: all authentication tokens updated successfully.
- 上一篇:messages日志清理
- 下一篇:使用nmcli配置ip
Powered By Cheug's Blog
Copyright Cheug Rights Reserved.