jxwjq 发表于 2018-5-21 06:13:47

linux ssh基本

  用于远程连接Secure   ShellProtocol
  默认端口 22协议版本 ssh2
  主要包含 ssh远程连接   SFTP服务
  服务端OpenSSH
  # rpm -qaopensshopenssl
  openssh-5.3p1-94.el6.x86_64
  openssl-1.0.1e-15.el6.x86_64   负责加密
  进程
  # ps -ef | grep sshd
  root       1243      10 19:06 ?      00:00:00 /usr/sbin/sshd
  支持RSA DSA密钥
  公钥Publickey    密钥Pivatekey
  1.X版本
  # less /etc/ssh/sshd_config配置文件
  # grep ServerKey/etc/ssh/sshd_config   临时公钥
  #ServerKeyBits 1024
  # sshroot@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)?
  客户端会生成   PrivateKey                  # 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+ PrivateKey   =Keypair    生成此密钥对,,,,通过此交换数据
  危险:此后交换数据不检查 key pair
  
  Version2 多加了一个确认联机正确性的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
  COMMANDPID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
  sshd    1162 root    3uIPv410478      0t0TCP *:ssh (LISTEN)
  sshd    1162 root    4uIPv610480      0t0TCP *:ssh (LISTEN)
  sshd    1437 root    3rIPv411491      0t0TCP 192.168.10.11:ssh->bogon:62818 (ESTABLISHED)
  
  # nmap   192.168.10.10-p1-65535扫描端口
  基本命令
  # sshroot@192.168.10.10
  # sshroot@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
  # sftproot@192.168.10.10
  
  put/root/xx    /tmp上传加客户端本地路径      
  sftp> get /root/xx /tmp       下载到本地的当前目录
  
页: [1]
查看完整版本: linux ssh基本