ubuntu16.4中安裝samba服務


一、下載samba軟件包,不用安裝其他的了,因為它會自動幫我們下載所需要的其他依賴包

sudo apt-get install samba

二、修改/etc/samba目錄下的配置文件,smb.conf

以下所有操作需要切換到root用戶

su - root

修改文件

gedit smb.conf

在[gloabal]欄目下添加

#======================= Global Settings =======================

[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup = WORKGROUP
security = user

在-------share Defination------下添加共享欄目

[pc]
   comment = All Printers
   browseable = yes
   path = /home/pc/work
   read only = no
   valid users = @pc

三、添加samba用戶

該用戶需要是ubuntu16.4的現有用戶,如果沒有需要創建,本系統中已有用戶pc

添加samba用戶pc

smbpasswd -a pc

 

激活samba用戶pc

smbpasswd -e pc

四、重啟samba服務

systemctl restart smbd.service nmbd.service

五、檢測是否成功

查看虛擬機ip地址

pc@pc-virtual-machine:/etc/samba$ ifconfig
ens33     Link encap:Ethernet  HWaddr 00:0c:29:95:2e:c1  
          inet addr:111.186.98.93  Bcast:111.186.98.127  Mask:255.255.255.128
          inet6 addr: 2001:da8:8006:125:56eb:6ca9:8682:51a3/64 Scope:Global
          inet6 addr: fe80::8dfa:48e3:4e6b:1df0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:48479 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1927 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4277804 (4.2 MB)  TX bytes:161866 (161.8 KB)
          Interrupt:19 Base address:0x2000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:882 errors:0 dropped:0 overruns:0 frame:0
          TX packets:882 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:58273 (58.2 KB)  TX bytes:58273 (58.2 KB)

在windows主機上進行訪問

打開運行

點擊確定

此時可以進行正常訪問了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM