1、ssh簡介
1.1 ssh(安全外殼協議)
ssh為secure shell的縮寫,ssh為建立在應用層和傳輸層基礎上的安全協議。
1.2 ssh埠
2、ssh加密原理ssh埠:22
linux中守護程序:sshd
安裝服務:openssh
服務端主程式:/usr/sbin/sshd
客戶端主程式:/usr/bin/ssh
2.1 對稱加密演算法
採用單密匙系統的加密方法,同乙個密匙可以同時用作資訊的加密和解密,這種加密方法稱為對稱加密,也成為單密匙加密。
2.2 非對稱加密演算法
非對稱加密演算法(asymmetric cryptographic algorithm)又名「公開密匙加密演算法」,非對稱加密演算法需要兩個密匙:公開密匙(publickey)和私有密匙(privatekey)
2.3 ssh安全外殼協議
3、ssh配置檔案
3.1 /etc/ssh/sshd_config
3.2 安全設定部分port 22 埠 建議修改埠號
listenaddress 0.0.0.0 監聽的ip
protocal 2 ssh版本選擇
hostkey /etc/ssh/ssh_host_rsa_key 私匙儲存位置
serverkeybits 1024 私匙的位數
syslogfacility auth 日誌記錄ssh登入情況
loglevel info 日誌等級
gssapiauthentication yes gssapi認證開啟 建議在ssh_config中關閉
4、常用ssh命令permitrootlogin yes 允許root的ssh登入 建議修改為no
pubkeyauthentication yes 是否使用公匙驗證 建議使用密匙對登入
authorizedkeysfile .ssh/authorized_keys 公匙的儲存位置
passwordauthentication yes 允許使用密碼驗證登入 建議修改為no,而使用密匙對登入
permitemptypasswords no 不允許空密碼登入
4.1 ssh命令
4.2 scp遠端複製ssh 使用者名稱@ip
$ ssh root@192.168.44.5
$ scp root@192.168.44.2:/root/test.txt .
上傳$ scp –r /root/123/ root@192.168.44.2/root
4.3 sftp檔案傳輸 這種操作並不方便,也不安全
5、ssh連線工具$ sftp root@192.168.44.2
sftp> ls 檢視伺服器端資料
sftp> cd 切換伺服器端目錄
sftp> lls 檢視本地資料
sftp> lcd 切換本地目錄
sftp> put 上傳
5.1 securecrt
5.2 xshell
6、密匙對登入
6.1 密匙對驗證
6.1.1 步驟1
6.1.2 步驟2client端:
$ ssh-keygen –t rsa
server端:
把公鑰上傳到伺服器端
$ cat id_rsa.pub >> /root/.ssh/authorized_keys
$ chmod 600 /root/.ssh/authorized_keys
6.1.3 步驟3修改伺服器端ssh配置檔案 /etc/ssh/sshd_config
rsaauthentication yes 開啟rsa驗證
pubkeyauthentication yes 是否使用公匙驗證
authorizedkeyfile .ssh/authorized_keys 公匙儲存位置
passwordauthentication no 禁用使用密碼驗證登入
6.1.4 遠端工具匯入公匙登入伺服器端關閉selinux服務
$ vi /etc/selinux/config
重啟linux作業系統
伺服器端重啟ssh服務
$ service sshd restart
遠端管理服務
第乙個步驟 在客戶端建立金鑰對資訊 管理主機10.0.0.61 root m01 ssh keygen t dsa root m01 ll ssh total 8 rw 1 root root 668 mar 4 10 36 id dsa rw r r 1 root root 598 mar 4 1...
ssh遠端管理服務
openssh service 提供服務 openssh clients 客戶端 sshd服務的埠號 22 root linux server yum install y openssh 1.伺服器端啟動服務 systemctl start sshd 2.關閉防火牆和selinux遠端登入 root...
SSH遠端管理服務
ssh 安全外殼協議 ssh為secure shell的縮寫,ssh為建立在應用層和傳輸層基礎上的安全協議。採用非對稱加密演算法。用法 ssh root ip位址 ssh埠 ssh埠 22.linux中守護程序 sshd 安裝服務 openssh 服務端主程式 usr sbin sshd 客戶端主程...