利用samba實現Ubuntu18.04與Windows10的文件共享

在Ubuntu18.04上安裝samba服務

打開終端,使用下面指令安裝samba服務。shell

$ sudo apt install samba
$ sudo apt install smbclient

在Ubuntu18.04上配置samba服務

編輯samba的配置文件ubuntu

$ sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
$ sudo vim /etc/samba/smb.conf

末尾添加以下:vim

[share]    
        comment = Shared Folder with username and password
        path = /home/你的用戶名/Share/    
        available = yes    
        browseable = yes    
        public = yes    
        writable = yes

建立共享文件夾windows

$ mkdir  ~/Share
$ chmod 777 ~/Share

建立smba帳戶服務器

$sudo touch /etc/samba/smbpasswd 
$sudo smbpasswd -a 你的帳戶名

重啓samba服務器測試

sudo /etc/init.d/samba restart

測試spa

smbclient -L //localhost/Share

test_samba_in_ubuntu.png

使用rest

能夠到windows下輸入ip使用了,在文件夾處輸入 "\\" + "Ubuntu機器的ip或主機名" + "\\" + "Share"

若是訪問失敗就須要按下面的步驟對Windows 10 進行配置。code

配置Windows 10

打開win10對smb1.0/cifs文件共享支持 blog

enable_samba_in_windows10.png

編輯本地策略組
enable_samba_in_windows10_02.png

重啓win10 ,而後訪問

在文件夾處輸入 "\\" + "Ubuntu機器的ip或主機名" + "\\" + "Share"
相關文章
相關標籤/搜索