Linux - 搭建Samba服務器

環境:

 - 電腦系統:macOS Sierrabash

 - 系統:虛擬化軟件Vagrant based on Centos7.2服務器

[root@localhost vagrant]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)

 

安裝Samba:

[root@localhost vagrant]# yum install samba -y

 - 安裝完成以後,按照需求設置配置文件,文件位於/etc/samba/smb.conf。less

    此處的"global"中配置應用默認設置,需新增"share"段。spa

[global]
        workgroup = SAMBA
        security = user

        passdb backend = tdbsam

        printing = cups
        printcap name = cups
        load printers = yes
        cups options = raw

[share]
        path=/data
        available=yes
        browseable=yes
        public=yes
        writable=yes

 - 設置中"share - path"的目錄要設置相應的權限,不然會出現不能訪問的狀況。vagrant

 

建立samba用戶:

「sherry」 爲自行設置的usernamecode

[root@localhost vagrant]# touch /etc/samba/smbpasswd
[root@localhost vagrant]# smbpasswd -a sherry
New SMB password:
Retype new SMB password:

 

重啓samba服務器:

- 查看samba服務的狀態。ip

[root@localhost vagrant]# smbstatus

 - rpm軟件包管理器查看samba被包含在哪些包裏。虛擬機

[root@localhost vagrant]# rpm -ql samba | less


/etc/openldap/schema
/etc/openldap/schema/samba.schema
/etc/pam.d/samba
/usr/bin/eventlogadm
/usr/bin/smbstatus
/usr/lib/systemd/system/nmb.service
/usr/lib/systemd/system/smb.service
/usr/lib64/samba/auth
/usr/lib64/samba/auth/script.so

    能夠看出smb.service是用systemd啓動的;it

- 使服務自動啓動io

[root@localhost vagrant]# systemctl enable smb.service

- 查看服務狀態

[root@localhost vagrant]# systemctl status smb.service

 

正常配置在這裏就能夠了,由於個人虛擬機還沒有配置公共IP,因此這裏須要多一些操做,你們能夠略過此步。

Vagrant配置IP

。。。待續

相關文章
相關標籤/搜索