Debian Linux 系統Samba安裝和配置

2021-09-26 22:53:07 字數 1767 閱讀 5174

root使用者下直接使用以下命令

apt-get install samba

若是普通使用者下使用以下命令

sudo apt-get install smaba

samba的配置檔案在/etc/samba/路徑下,檔名為smb.conf,注意需要root使用者許可權才能編輯該檔案,我是用root使用者下使用vim進行編輯修改的。

在檔案末尾新增以下內容

[test]

comment = samba test

path = /home/d/share //共享檔案路徑

browseable = yes

read only = no

guest ok = yes

writable = yes

smbpasswd -a 使用者名稱

接著需要兩次輸入密碼

此處設定的使用者和密碼,是用來登入用的

可能出現的錯誤

執行smbpasswd有可能會出現以下錯誤:

bash: smbpasswd: command not found
解決辦法:出現該錯誤表示samba-client沒有安裝

執行命令apt-get install samba-client

執行samba-client命令可能會出現以下錯誤:

smbclient: depends: libwbclient0 (= 2:4.5.16+dfsg-1+deb9u1) but 2:4.5.16+dfsg-1+deb9u2 is to be installed
解決辦法:

執行命令 apt-get autoremove libwbclient0 //解除安裝之前安裝的版本

執行命令 apt-get install libwbclient0=2:4.5.16+dfsg-1+deb9u1 //安裝所需要的版本

通過以上命令即可解決問題,此時可以執行apt-get install samba-client,將成功安裝samba-client

使用命令 systemctl start smb

執行以上命令會報錯:failed to start smb.service: unit smb.service not found

到目錄/etc/init.d目錄下可以發現沒有smb檔案,但可以發現smnd和nmbd檔案,使用這兩個執行檔案來起動samba服務,執行以下命令:

systemctl restart smbd.service nmbd.service
若執行上述命令時,出現以下錯誤:

failed to restart smbd.service: unit smbd.sercvice not found

failed to restart nmbd.service: unit nmbd.service not found

出現上述錯誤的原因是因為samba沒有安裝成功,因此需要執行apt-get install samba,重新安裝samba,安裝完成以後,再執行以上命令,即可成功起動samba服務

若要檢視samba服務是否起動成功,只需要執行命令systemctl status smbd.service,執行該命令後,可以在終端上看到active(running),表明samba服務已經起動成功。

debian linux 版本代號

發行版目錄 下一代 debian 正式發行版的代號為 buster 發布時間尚未確定 debian 9 stretch 當前的穩定版 debian 8 jessie 被淘汰的穩定版 debian 7 wheezy 被淘汰的穩定版 debian 6.0 squeeze 被淘汰的穩定版 debian g...

debian linux網絡卡啟動不了

debian linux網絡卡啟動不了 第一次使用debian作業系統,目前只知道一種配置ip位址的方法,就是在 et network目錄下編輯inte ces檔案,新增如下內容,開機自動啟用eth0介面 auto eth0 配置eth0介面為靜態設定ip位址 iface eth0 inet sta...

Debian Linux下的vim安裝

作業系統 debian 9.1.0 amd64 64bit 絕大多數的linux系統中都存在python的直譯器。1.在linux系統的命令視窗下輸入python,測試是否安裝python,如果python已經安裝,會出現下圖中的資訊.2.安裝python 安裝軟體,要進入到root許可權下,輸入s...