我在服务器上安装了samba,我试图编写一个脚本来节省我两个添加用户的步骤,例如:
adduser username
smbpasswd -a username
我的smb.conf
状态:
# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.
unix password sync = yes
进一步的阅读使我进入了pdbedit
手册页,其中指出:
-a This option is used to add a user into the database. This com-
mand needs a user name specified with the -u switch. When adding
a new user, pdbedit will also ask for the password to be used.
Example: pdbedit -a -u sorce
new password:
retype new password
Note
pdbedit does not call the unix password syncronisation script if
unix password sync has been set. It only updates the data in the
Samba user database.
If you wish to add a user and synchronise the password that im-
mediately, use smbpasswd’s -a option.
所以...现在我决定尝试添加具有以下内容的用户smbpasswd
:
第一次尝试,Unix用户仍然不存在:
root@raspberrypi:/home/pi# smbpasswd -a newuser
New SMB password:
Retype new SMB password:
Failed to add entry for user newuser.
第二次尝试,Unix用户存在:
root@raspberrypi:/home/pi# useradd mag
root@raspberrypi:/home/pi# smbpasswd -a mag
New SMB password:
Retype new SMB password:
Added user mag.
# switch to user pi, and try to switch to mag
root@raspberrypi:/home/pi# su pi
pi@raspberrypi ~ $ su mag
Password:
su: Authentication failure
所以,现在我问自己:
- 如何使samba密码与Unix密码同步?
- samba密码存储在哪里?
有人可以帮助启发我吗?
/var/lib/samba/
,我相信密码在其中,secrets.tdb
但我不确定。至于你以前的问题,我怀疑是否有一个简单的方法。