linux ssh基本
用于遠程連接 ?Secure ? Shell ?Protocol
默認端口 22 ?協議版本 ssh2
主要包含 ssh遠程連接 ? SFTP服務
服務端OpenSSH
# rpm -qa? openssh ?openssl
openssh-5.3p1-94.el6.x86_64
openssl-1.0.1e-15.el6.x86_64 ? ? 負責加密
進程
# ps -ef | grep sshd
root? ? ? ?1243? ? ? 1? 0 19:06 ?? ? ? ? 00:00:00 /usr/sbin/sshd
支持RSA DSA密鑰
公鑰Public ?key ? ?密鑰Pivate ?key
1.X版本
# less /etc/ssh/sshd_config ?配置文件
# grep ServerKey? /etc/ssh/sshd_config ? ? 臨時公鑰
#ServerKeyBits 1024
# ssh? root@192.168.10.10 ? ? ? ? ? 會接受服務端的公鑰
The authenticity of host '192.168.10.10 (192.168.10.10)' can't be established.
RSA key fingerprint is c6:94:5f:af:17:75:7f:dd:bc:2a:54:83:f3:5a:d2:dc.
Are you sure you want to continue connecting (yes/no)?
客戶端會生成 ? Private ?Key ? ? ? ? ? ? ? ? ? ?# cat /etc/ssh/ssh_config
# ll ~/.ssh/known_hosts
-rw-r--r-- 1 root root 395 4月? ?3 19:37 /root/.ssh/known_hosts
ServerKey ?+?Private ?Key ? ? =Key ?pair ? ?生成此密鑰對,,,,通過此交換數據
危險: ?此后交換數據不檢查 key pair
Version ?2 多加了一個確認聯機正確性的Diffie - Hellman 機制
檢查數據的來源是否正確。
基于口令
基于密鑰 ? ? ? ? ? ? ? ?
# netstat? -lntup | grep 22
tcp? ? ? ? 0? ? ? 0 0.0.0.0:22? ? ? ? ? ? ? ? ? 0.0.0.0:*? ? ? ? ? ? ? ? ? ?LISTEN? ? ? 1162/sshd? ? ? ? ? ?
tcp? ? ? ? 0? ? ? 0 :::22? ? ? ? ? ? ? ? ? ? ? ?:::*? ? ? ? ? ? ? ? ? ? ? ? LISTEN? ? ? 1162/sshd ??
# lsof -i :22
COMMAND? PID USER? ?FD? ?TYPE DEVICE SIZE/OFF NODE NAME
sshd? ? 1162 root? ? 3u? IPv4? 10478? ? ? 0t0? TCP *:ssh (LISTEN)
sshd? ? 1162 root? ? 4u? IPv6? 10480? ? ? 0t0? TCP *:ssh (LISTEN)
sshd? ? 1437 root? ? 3r? IPv4? 11491? ? ? 0t0? TCP 192.168.10.11:ssh->bogon:62818 (ESTABLISHED)
# nmap? ?192.168.10.10? -p1-65535 ?掃描端口
基本命令
# ssh? root@192.168.10.10
# ssh? root@192.168.10.10 ifconfig
# scp ? xx ? ?root@192.168.10.10:/tmp ? ? cp文件 xx 到 ? /tmp
# scp root@192.168.10.10:/tmp/xx? . ? ? ? ?相反
SFTP
# sftp? root@192.168.10.10
put ?/root/xx ? ?/tmp ?上傳 ?加客戶端本地路徑 ? ? ?
sftp> get /root/xx /tmp ? ? ? 下載到本地的當前目錄
轉載于:https://blog.51cto.com/hequan/1761324
總結
以上是生活随笔為你收集整理的linux ssh基本的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mac 抓包工具chares破解
- 下一篇: MYSQL 更改数据库data存储目录