四 配置sshd与samba服务
對于需要交叉編譯的嵌入式開發(fā)環(huán)境,在Linux下配置好Samba 及sshd,基本就可以滿足需求了。
?
一、samba服務(wù)配置
1. 下載samba
sudo apt-get install samba可以使用命令:systemctl list-unit-files 查看一下支持的服務(wù)
?
2. firewall關(guān)閉或放行相應(yīng)的業(yè)務(wù) (參見firewall-cmd命令) ---- deepin 暫時沒有,可略過
systemctl stop firewalldsystemctl disable firewalldfirewall-cmd --zone=public --add-service=sshfirewall-cmd --zone=public --add-service=samba3. 關(guān)閉SELinux模塊 (這個修改后,好像要重啟才能生效) ---- deepin 暫時沒有,可略過
?
[root@localhost config]# getenforce
Permissive
[root@localhost config]#
?
4.添加用戶
smbpasswd -a wangxinyu
?
5. 修改配置文件
[work]comment = wxy_workpath = /home/wangxinyu/work ; guest ok = nobrowseable = yeswriteable = yescreate mask = 0777directory mask = 0777在/etc/samba/smb.conf增加發(fā)下配置,如wangxinyu是用戶,然后在/home/wangxinyu/下建立相應(yīng)的work目錄 (注意此目錄需要給定權(quán)限,建議至少 0770)
?
6. 重新啟動進行訪問
systemctl start smbd
systemctl enable smbd ---- 加入默認啟動項
?
7. 測試方法
Linux下samba client用的少,但也可以用來測試
smbclient -L //127.0.0.1/ 查看支持情況
smbclient //127.0.0.1/wangxinyu 進入后類似FT客戶端
?
在windows下文件夾路徑中輸入 :\\192.168.226.132\work
驗證通過后,添加映射網(wǎng)絡(luò)驅(qū)動器的方式來當分區(qū)硬盤來訪問
?
二、sshd服務(wù)配置
1. 下載sshd服務(wù)
apt-get install sshd
2. 啟動sshd服務(wù)
systemctl start sshd
systemctl enable sshd ---- 加入默認啟動項
3. 測試
在xshell中直接輸入 ssh wangxinyu@192.168.226.132 驗證
?
4.配置xshell公鑰登錄
?
在deepin中輸入如下命令
apt-get install lrzszcd ~mkdir .sshssh-keygen -t rsa -----創(chuàng)建鑰匙命令:,一路按Y搞定cat id_rsa.pub > authorized_keys ----- 公鑰文件,在sshd_config中有指定sz id_rsa ---- 把密鑰保存到本地,給xshell使用按照流程走完后會在 ~/.ssh目錄下(用戶所在家目錄下的.ssh目錄)看到id_rsa, id_rsa.pub文件 第一個是私有密鑰 第二個是公共密鑰
?
修改SSH配置文件,命令:vim /etc/ssh/sshd_config , 打開如下配置
PubkeyAuthentication yes
AuthorizedKeysFile????? .ssh/authorized_keys
重啟SSH服務(wù):systemctl restart sshd.service
?
xshell 配置如下:
?
?
在瀏覽中,把導(dǎo)出的私鑰上傳
?
最后點擊連接。
?
總結(jié)
以上是生活随笔為你收集整理的四 配置sshd与samba服务的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 三 虚拟机安装Deepin
- 下一篇: 六 运行级别调整增加启动项