1. 程式人生 > 實用技巧 >Linux系統與服務構建(二)

Linux系統與服務構建(二)

Samba服務的使用

1.安裝Samba

[root@samba ~]# yum -y install samba

2.配置Samba服務

修改/etc/samba/smb.conf
修改裡面[global]的內容

        load printers = no
        cups options = raw

;       printcap name = /dev/null
        # obtain a list of printers automatically on UNIX System V systems:
;       printcap name = lpstat
;       printing = bsd
        disable spoolss = yes

在檔案最後加入share

[share]
        path=/opt/share
        browseable = yes
        public = yes
        writeable = yes

path:這個目錄是將要共享的目錄,如果沒有,需要建立
browseable:引數是操作許可權
public:引數是訪問許可權
writable:引數是對檔案操作許可權
建立檔案並賦予許可權

[root@samba ~]# mkdir /opt/share
[root@samba ~]# chmod 777 /opt/share/

啟動samba服務

[root@samba ~]# systemctl start smb
[root@samba ~]# systemctl start nmb
[root@samba ~]# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      8876/smbd           
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1291/sshd           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1387/master         
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      8876/smbd           
tcp6       0      0 :::139                  :::*                    LISTEN      8876/smbd           
tcp6       0      0 :::22                   :::*                    LISTEN      1291/sshd           
tcp6       0      0 ::1:25                  :::*                    LISTEN      1387/master         
tcp6       0      0 :::445                  :::*                    LISTEN      8876/smbd     

建立使用者

[root@samba ~]# smbpasswd -a root
New SMB password:
Retype new SMB password:
Added user root.
[root@samba ~]# service smb restart
Redirecting to /bin/systemctl restart  smb.service