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       下载到本地的当前目录











本文转自 295631788 51CTO博客,原文链接:http://blog.51cto.com/hequan/1761324,如需转载请自行联系原作者
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值