迷路的风吧 关注:8贴子:235
  • 1回复贴,共1

Centos7 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
// smbpasswd -a www//centos7添加用户方法
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的两种方法
断开共享连接cmd命令
1 net use * /del来源: <http://foooy.me/linux/159.html>


1楼2015-08-09 17:54回复
    [global]
    workgroup = WORKGROUP
    server string = CentOS Server SAMBA Version %v
    log file = /var/log/samba/log.%m
    max log size = 50
    security = user
    smb passwd file = /etc/samba/smpasswd
    #============================ Share Definitions ==============================
    [web]
    workgroup = apache
    netbios name = apache
    path = /var/www/
    browsable = yes
    writeable = yes
    [net]
    public = yes
    path = /var/www/html


    2楼2015-08-09 18:00
    回复