19.SSH服务

SSH服务

一、ssh协议

          1.ssh(secure shell,安全外壳协议),该协议有两个常用的作用:远程连接协议、远程文件传输协议。

          2.协议使用的端口号:默认是22

          3.要想修改端口号,就必须要从ssh服务的配置文件中修改:  /etc/ssh/ssh_config

          4.通过vim  /etc/ssh/ssh.config查看端口号:

             

          5.修改端口号:a)先将端口号前的“#”删除。

                                   b)然后再修改端口号。

                        注意:a)不能修改成已经被占用的端口号。

                                   b)端口号的范围是0~65535

           6.启动/停止/重启 ssh服务

                    方式一:service   sshd   start/stop/restart

                    方式二:/etc/init.d/sshd    start/stop/restart

二、远程终端

          1.远程终端主要帮助运维人员连接远程的服务器,常见的终端工具有:Xshell、secureCRT、Putty,这里putty更轻量方便使用所以用putty。

          2.使用终端工具连接服务器:

                    a).要连接服务器要先知道IP地址,通过ifconfig可以查看ip地址:

                           

                    b).然后我们可以先通过window中的cmd输入:Ping   192.168.241.128来测试该地址是否联通。

                           

                     c).此时测试连通性以后,我们可以直接使用putty.exe连接该IP地址

                            

                      d).连接后会进入登录界面让你输入用户名和密码,输入正确后即可进入服务器

                            

           3.该方法来连接后可以明显看出多用户登录到一个服务器中。             

三、使用ssh服务传输文件

          1.要想传输文件我们需借助一个工具:FileZilla,他是一个可视化的文件传输工具。

          2.使用FileZilla传输文件:

                    a)安装FileZilla

                    b)打开FileZilla,左上角“文件”——》“新建站点”——》如图操作——》连接

                                  

                    c)进入到传输界面中以后,我们可以从服务器下载文件,也可以向服务器上传文件

                         下载文件:选择本地存放的路径,然后直接将服务器中的文件拖拽进去,或者右键下载

                         上传文件:选择服务器存好的路径,然后直接将本地文件拖拽进去,或者右键上传

                          

                      d)上传或下载完成后,可以去查看文件是否已经成功传输。

四、使用命令行传输文件

          1.要是使用命令行传输文件,我们需要借助一个命令行工具:PSCP.exe(Putty Secure Copy client,该工具必须通过cmd运行,不能直接打开)。

          2.因为PSCP.exe必须用过命令行打开,所以我们需要配置他的环境变量或者将他放在C:/Windows目录下。

          3.打开后使用命令传输文件:

                    a)从服务下载文件:pscp  选项  用户名@主机地址:资源路径  wndows  本地的地址

                    b)上传文件到服务器:pscp  选项  资源路径  用户名@主机地址:远程路径  

                    c)列出服务器中的路径结构:pscp  选项  -ls  用户名@主机地址   

                   

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
OpenSSH_9.2p1 Debian-2, OpenSSL 3.0.9 30 May 2023 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files debug1: /etc/ssh/ssh_config line 21: Applying options for * debug1: Connecting to lxslc702.ihep.ac.cn [2401:de00:2:332::186] port 22. debug1: Connection established. debug1: identity file /home/fyf/.ssh/id_rsa type -1 debug1: identity file /home/fyf/.ssh/id_rsa-cert type -1 debug1: identity file /home/fyf/.ssh/id_ecdsa type -1 debug1: identity file /home/fyf/.ssh/id_ecdsa-cert type -1 debug1: identity file /home/fyf/.ssh/id_ecdsa_sk type -1 debug1: identity file /home/fyf/.ssh/id_ecdsa_sk-cert type -1 debug1: identity file /home/fyf/.ssh/id_ed25519 type -1 debug1: identity file /home/fyf/.ssh/id_ed25519-cert type -1 debug1: identity file /home/fyf/.ssh/id_ed25519_sk type -1 debug1: identity file /home/fyf/.ssh/id_ed25519_sk-cert type -1 debug1: identity file /home/fyf/.ssh/id_xmss type -1 debug1: identity file /home/fyf/.ssh/id_xmss-cert type -1 debug1: identity file /home/fyf/.ssh/id_dsa type -1 debug1: identity file /home/fyf/.ssh/id_dsa-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_9.2p1 Debian-2 debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4 debug1: compat_banner: match: OpenSSH_7.4 pat OpenSSH_7.4* compat 0x04000006 debug1: Authenticating to lxslc702.ihep.ac.cn:22 as 'fanyufan' debug1: load_hostkeys: fopen /home/fyf/.ssh/known_hosts: No such file or directory debug1: load_hostkeys: fopen /home/fyf/.ssh/known_hosts2: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: algorithm: curve25519-sha256 debug1: kex: host key algorithm: ssh-ed25519 debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY Connection closed by 2401:de00:2:332::186 port 22
最新发布
07-08

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值