samba共享服务器

局域网内为了共享资料,在一台ubuntu系统上搭建了一个简单的samba服务提供共享。

系统环境为ubuntu10.04.4版本

samba的安装
apt-get install samba smbclient samba-common smbfs

 

修改samba的配置文件/etc/samba/smb.conf

root@ubuntu3:~# egrep -v ';|#|^$' /etc/samba/smb.conf 过滤后的配置文件如下

 

[global]
workgroup = WORKGROUP
server string = %h server (Samba,ubuntu)
wins support = yes  #开启wins支持
dns proxy = no
log file = /var/log/samba/log.$m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
security = user  #使用默认的安全等级user,其他的还有share,domain

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
display charset = UTF-8
unix charset = UTF-8
dos charset = cp936
[share]
path = /samba_share
available = yes
writeable = yes
browseable = yes
valid users = @samb,admin

建立本地组samb,本地用户admin,wang,user1,uuser2

groupadd samb #samb组

useradd -s /usr/sbin/nologin admin

useradd -s /usr/sbin/nologin -G samb wang

user1和user2同用户wang的建立方式建立

建立共享目录,修改权限

mkdir /samba_share && chown admin:samb /samba_share && chmod 775 /samba_share

添加账户到samba中

smbpasswd -a admin 回车后输入密码,其他用户同样操作。

启动samba服务测试

/etc/init.d/smbd restart

smbclient -L SERVER-IP -U USER-NAME #查看SERVER-IP共享目录

mount -t smbfs -o codepage=cp936,username=USER-NAME,password=PWD //SERVER-IP/SHARE-DIR   MOUNT-DIR

 

你可能感兴趣的:(samba共享)