LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1021|回复: 8

root用户如何用script修改密码

[复制链接]
发表于 2006-9-11 22:24:55 | 显示全部楼层 |阅读模式
需要在knoppix下写一个开机运行的脚本,修改root的password,不知怎么写。
发表于 2006-9-11 22:34:04 | 显示全部楼层
man passwd ,see --stdin
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-9-11 22:51:15 | 显示全部楼层

看了man passwd, 没看到 --stdin

看了man passwd, 没看到 --stdin.

我知道在命令行上可以用passwd命令,不知道用script怎么写。
回复 支持 反对

使用道具 举报

发表于 2006-9-11 23:31:23 | 显示全部楼层
--stdin是redhat公司发行的passwd程序才有的选项。
我这也是RH的PASSWD程序,没法测试
回复 支持 反对

使用道具 举报

发表于 2006-9-12 04:27:30 | 显示全部楼层
take a look chpasswd (specially the --md5 opt)
回复 支持 反对

使用道具 举报

发表于 2006-9-12 18:28:15 | 显示全部楼层
rh as4.0  里 chpasswd 没有 --md5 opt
是不是可以直接操作/etc/shadow里面的相应字段.
回复 支持 反对

使用道具 举报

发表于 2006-9-13 00:18:14 | 显示全部楼层
hmm... that's interesting... I don't recommend to manipulate the shadow file directly since the passwd down there is normally md5 encrypted. Take a look the man shadow and see what is used to encrypt the passwd.
回复 支持 反对

使用道具 举报

发表于 2006-9-13 08:53:40 | 显示全部楼层
直接修改shadow就可以。
回复 支持 反对

使用道具 举报

发表于 2006-9-16 00:03:42 | 显示全部楼层
RHEL5 has the opts.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表