Linux与Windows共享文件SAMBA

Linux与Windows共享文件SAMBA

a)先配置/etc/samba/smb.conf
cat /etc/samba/smb.conf <<EOF
[global]
workgroup = linuxgroup
server string = linux-smb
dos charset = cp936
unix charset = utf8
hosts allow = 192.168.1.     #允许的连接的IP段,这里要注意一下
log file = /var/log/samba/%m.log
max log size = 50
socket options = TCP_NODELAY
security = user
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd
username map = /etc/samba/smbusers
dns proxy = no

[share]
path = /mnt/share/
;guest ok = yes
browseable = yes
create mask = 0755
writeable = yes
EOF

b)创建smbpasswd文件,并添加用户
cat /etc/passwd | mksmbpasswd.awk > /etc/samba/smbpasswd
smbpasswd -ae $USER

其中mksmbpasswd.awk脚本在samba源码包的某个目录中有,$USER是指一个用户名,用这个用户名和设置的密码登入SAMBA服务器

c)连接
在Windows中访问SAMBA服务器,只要在网络邻居中添加一个连接就可以,输入地址时输入类似\\192.168.1.1\share的地址。
很基本的配置