centos下Samba配置

1、安装samba(CentOS Linux):

1 yum install samba system-config-samba samba-client samba-common

2、创建www账号 

1 /usr/sbin/groupadd www
2 /usr/sbin/useradd -g www www
3 mkdir -p /data/
4 chown -R www:www /data/
5 chmod 777 /data/
6 cat /etc/passwd | mksmbpasswd.sh> /etc/samba/smbpasswd

3、创建samba配置文件

1 mv -f /etc/samba/smb.conf /etc/samba/smb.conf.bak
2 vim /etc/samba/smb.conf

输入以下内容:

1 [global]
2 server string = Samba Server
3 security = user  //如果需要匿名访问这个修改成share,下文的net目录就可以匿名访问
4 encrypt passwords = yes
5 smb passwd file = /etc/samba/smbpasswd

1 [net]
2 public = yes
3 path = /data/net

1 [web]
2 workgroup = www
3 netbios name = www
4 path = /data/
5 browseable = yes
6 writeable = yes

4、为samba用户www设立一个密码:

1 smbpasswd -a www

 

5、启动samba:

1 /sbin/service smb start



6添加到系统启动

1 vim /etc/rc.d/rc.local


末行加入

1 /etc/init.d/smb restart


7、在iptables中139端口,或者关闭iptables, /sbin/service iptables stop

 

8、在我的电脑上右键–映射网络驱动器,输入samba服务器的ip,输入www用户名和设置的密码,即可进入,如果提示没有权限可能是selinux问题,处理方法见 : 关闭SELinux的两种方法

发表评论

邮箱地址不会被公开。 必填项已用*标注