[root@localhost ~]# yum -y install samba         #安装Samba

[root@localhost ~]# rpm -qa | grep samba          #查看系统已安装的软件包

[root@localhost ~]# vim /etc/samba/smb.conf   #修改配置文件

[global]部分
把”workgroup = MY GROUP”改成”workgroup = WORKGROUP”
把” security = user” 修改为 “security = share”
然后在文件的最末尾处加入以下内容:
[share]
        comment = share all
        path = /opt/abc
        browseable = yes
        public = yes
        writable = no

[root@localhost ~]# cd /opt       #切换到opt目录下

[root@localhost opt]# mkdir abc   #创建abc文件

[root@localhost opt]# chmod 777 /opt/abc  #赋予最大权限

[root@localhost opt]# service iptables stop #关闭防火墙

[root@localhost opt]# service smb start  #启动samba服务

[root@localhost opt]# netstat -natp   #查看samba服务端口

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2866/master
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 59879/smbd
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 59879/smbd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1887/rpcbind
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1793/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 3435/cupsd
tcp 0 0 0.0.0.0:44824 0.0.0.0:* LISTEN 2243/rpc.statd
tcp 0 0 192.168.127.132:22 192.168.127.1:59754 ESTABLISHED 59546/sshd: root@pt
tcp6 0 0 ::1:25 :::* LISTEN 2866/master
tcp6 0 0 :::47705 :::* LISTEN 2243/rpc.statd
tcp6 0 0 :::445 :::* LISTEN 59879/smbd
tcp6 0 0 :::139 :::* LISTEN 59879/smbd
tcp6 0 0 :::111 :::* LISTEN 1887/rpcbind
tcp6 0 0 :::80 :::* LISTEN 54829/httpd
tcp6 0 0 :::21 :::* LISTEN 48703/vsftpd
tcp6 0 0 :::22 :::* LISTEN 1793/sshd
tcp6 0 0 ::1:631 :::* LISTEN 3435/cupsd

#139、445端口打开

可在客户端查看共享文件

05-11 22:59