增加samba用户提示Failed to add entry for user

[[email protected] ~]# smbpasswd -a test
New SMB password:
Retype new SMB password:
Failed to add entry for user test.
解决办法:
这是因为没有加相应的系统账号所以会提示Failed to add entry for user的错误,只需增加相应的系统账号test就可以了:
[[email protected] ~]# pw groupadd test -g 6000
[[email protected] ~]# pw useradd test -u 6000 -g 6000 -s/sbin/nologin -d/dev/null
这时就可以用smbpasswd -a test增加test这个samba账号了!为了增加系统的安全性,所以加的系统账号不要给shell它,也不给它指定目录,到时在/home目录给test账号建个文件夹,该文件夹只有test有读写权限即可!
如:
[[email protected] ~]# mkdir /home/test
[[email protected] ~]# chown -R test:test /home/test
若不想让另人访问,只让test用户可以访问,只需执行命令:
[[email protected] ~]# chmod u+rwx,g+rwx,o-rwx /home/test
这时可以用smbpasswd命令增加samba账号test了
[[email protected] ~]# smbpasswd -a test
New SMB password:
Retype new SMB password:
Added user test.
[[email protected] ~]#