bash 使用 pdbedit 工具更改 samba 服务器中的用户密码

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9208640/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 01:31:21  来源:igfitidea点击:

Change user password in samba server with the pdbedit tool

bashsambachange-password

提问by Lothar

I am trying to change user password with script but I'm having trouble using the -t option. Here's what I try:

我正在尝试使用脚本更改用户密码,但在使用 -t 选项时遇到问题。这是我的尝试:

echo -e "12345\n12345\n" | pdbedit -t -u username

So this is wrong somehow. Any ideas what I am missing or what should I try?

所以这在某种程度上是错误的。任何想法我缺少什么或我应该尝试什么?

回答by raph

$ printf "%s\n%s\n" pwd pwd|pdbedit -t -r -u user

does not appear to work either

似乎也不起作用

According to http://git.samba.org/?p=samba.git;a=blob;f=source3/utils/pdbedit.cthe --password-from-stdinparameter (pw_from_stdin) only affects account creation.

http://git.samba.org/?p=samba.git;a=blob;f=source3/utils/pdbedit.c--password-from-stdin参数(pw_from_stdin只影响帐户创建

Thus, you'll rather prefer smbpasswd

因此,您会更喜欢smbpasswd

$ printf "%s\n%s\n" pwd pwd|smbpasswd -s user

( Piping password to smbpasswd)

管道密码到 smbpasswd