【linux基础】linux远程登录SSH

 

 可以用ssh命令行方式登录。对方需要开启ssh服务。

 

SSH2是目前广泛使用的ssh版本,SSH协议是TCP协议,其占用的端口号是 22;

绝大多数Linux版本默认使用的SSH是openssh,通过 ssh -V 命令可以查看ssh的信息;

SSH分为服务器端和客户端,对于服务器端,SSH是默认开机启动的,作为常驻服务存在,我们可以通过 service sshd status 命令来查看;

 ssh root@172.25.215.40 命令来进行登陆,root是我们需要登陆的用户名,@后面跟的是我们的ip地址

scp 命令是用以在两台计算机之间进行快速的、加密的数据传输,命令的语法格式为:

scp 源文件 目标地址

如果是复制连续文件目录,可以添加-r属性;

 

1 检测ubantu是否安装ssh.输入命令ssh回车,有ssh命令的相关信息,则说
  明安装了ssh,但不知道是安装client还是server,
2 检测ubantu是安装的open-client还是openssh-server,输入dpkg -l|grep ssh
  发现,默认只安装了openssh-client
3 没安装openssh-server的ubuntu,是不能使用ssh被远程连接的
4 安装openssh-server,允许该ubuntu可以使用ssh命令去被远程连接

5 使用命令dpkg-l|grep ssh查看安装的结果,发现已安装openssh-server,该
  ubuntu也可以使用ssh命令远程连接

 本机防火墙关闭;

检查是否能够ping通:ping hostIP

工作站关机重启之后,IP发生了变化,所以出现time out的问题;

怎么可以设置工作站的IP不变呢?这就涉及到设置为静态IP而非DHCP,需要专门写一篇博客;

 

本地主机:
远程主机:
 
问题:

Ubuntu 安装配置SSH(ssh: connect to host localhost port 22: Connection refused问题的解决)

原因:

默认情况,ubuntu 16.04是已安装openssh-client,没安装openssh-server,所以可以使用该ubuntu的ssh命令去远程连接别的安装过openssh-server的ubuntu主机,而该ubuntu却不能被远程连接的,因为没装openssh-server ;

ps -e|grep ssh  # 查看是否安装ssh服务
sudo apt-get install openssh-server  # 安装openssh-server
ssh localhost  # 输入密码连接本机

 

https://blog.csdn.net/qq_19339041/article/details/79967109

https://blog.csdn.net/qq_32599479/article/details/78782775

https://www.cnblogs.com/zlslch/p/6861364.html

https://blog.csdn.net/hongchangfirst/article/details/37529507
https://blog.csdn.net/m0_37864814/article/details/82961927

https://blog.csdn.net/qq_32599479/article/details/78782775

https://blog.csdn.net/qq_19339041/article/details/79967109

 

1.

https://blog.csdn.net/zilaike/article/details/78922524

2.

https://blog.csdn.net/qq_32599479/article/details/78782775

3.

https://blog.csdn.net/testcs_dn/article/details/69498797

4. 

https://blog.csdn.net/pucao_cug/article/details/64492550

5.

https://blog.csdn.net/qq_32599479/article/details/78782775

6.

https://blog.csdn.net/qq_19339041/article/details/79967109

7.

https://blog.csdn.net/m0_37864814/article/details/82961927

8.

https://blog.csdn.net/hongchangfirst/article/details/37529507

9. ubuntu 默认防火墙安装、启用、查看状态;

end

 

posted on   鹅要长大  阅读(429)  评论(0编辑  收藏  举报

编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示