ubuntu samba服务器多用户配置
在/home/下有多个用户目录A、B...,现通过samba共享,要求A用户对A用户组目录具有root权限,对其他目录具有
读权限,B用户对B目录具有root权限,对其他目录只读。并在登陆各个目录时要求输入samba用户名和密码。已在10.04上通过。
www.2cto.com
1、安装samba
sudo apt-get install samba
sudo apt-get install smbfs
2、添加
系统用户 sudo adduser A
sudo adduser B
sudo adduser xx (用户名) 注意不要用sudo uaeradd xx
sudo adduser xx
Adding user `xx' ...
Adding new group `xx' (1008) ...
Adding new user `xx' (1008) with group `xx' ...
Creating home directory `/home/xx' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: 输入该用户的登陆密码
Retype new UNIX password: 确认密码
passwd: password updated successfully
Changing the user information for dengyx
Enter the new value, or press ENTER for the default
Full Name []: 回车
Room Number []: 回车
Work Phone []: 回车
Home Phone []: 回车
Other []: 回车
Is the information correct? [Y/n] y
执行完之后会在/home/目录下创建用户组,用户和相应用户目录。
3、修改/etc/samba/smb.cof
[global]
workgroup = WORKGROUP
server string = %h server (Samba, Ubuntu)
dns proxy = no www.2cto.com
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
security = user
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
usershare allow guests = yes
[homes]
comment = home
valid user = %S
writable=yes
browseable=no
create mode = 0664
directory mode = 0775
www.2cto.com
[A]
path=/home/A
available=yes
browseable=yes
public=no
alid user = A
writable=yes
[B]
path=/home/B
available=yes
browseable=yes
public=no
alid user = B
writable=yes
4,添加samba用户和设置密码。
sudo smbpasswd -a A 会提示输入密码,输入两次ok,会同时建立samba用户和密码
sudo smbpasswd -a B
5、保存配置,重启samba服务 sudo /etc/samba/smbd restart
注意:有时候你输入用户和密码后会提示:
不允许一个用户使用一个以上用户名与一个服务器或共享资源的多重连接。中断与此服务器或共享资源的连接,然后在试一次...
请在
windows 下面,执行如下命令:运行-》cmd -》net use * /del /y