Ubuntu ssh远程登录

Ubuntu ssh远程登录ubuntussh远程登录

前言

ssh协议可以通过网线登录到目标设备,访问和控制设备,也可以传输文件,本文主要介绍ubuntu下远程登录的方法。

一、安装openssh-server

sudo apt install openssh-server

此时可能会提示缺少依赖,提示如下。

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 linux-headers-4.4.0-209-generic : Depends: linux-headers-4.4.0-209 but it is not going to be installed
 openssh-server : Depends: openssh-client (= 1:7.2p2-4ubuntu2.10)
                  Depends: openssh-sftp-server but it is not going to be installed
                  Recommends: ncurses-term but it is not going to be installed
                  Recommends: ssh-import-id but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

只需用apt把依赖装上即可。

sudo apt install linux-headers-4.4.0-209
sudo apt install openssh-client
sudo apt install openssh-server

二、远程登录

给设备和电脑接上网线,用ping检查是否连接成功。

ping 192.168.1.200
PING 192.168.1.200 (192.168.1.200) 56(84) bytes of data.
64 bytes from 192.168.1.200: icmp_seq=1 ttl=128 time=1.71 ms
64 bytes from 192.168.1.200: icmp_seq=2 ttl=128 time=2.00 ms
64 bytes from 192.168.1.200: icmp_seq=3 ttl=128 time=2.56 ms
64 bytes from 192.168.1.200: icmp_seq=4 ttl=128 time=1.67 ms
64 bytes from 192.168.1.200: icmp_seq=5 ttl=128 time=1.43 ms

连接成功后,使用ssh远程登录。(有些设备可能要输入账号密码)
在这里插入图片描述
此时终端为远程设备的终端,可以访问设备的文件系统。

三、可视化远程登录

如果要传输文件,使用命令行远程登录不太方便,ubuntu提供了可视化的远程登录。
在这里插入图片描述
进入文件系统,左侧会有Connect to Server这个选项。
在这里插入图片描述
在输入框内以以下格式输入目标设备的用户名、ip号及进入的目录,点击Connect即可登录到文件系统。

用户名:root
ip号:192.168.1.1
目录:app
sftp://root@192.168.1.1/app

今天的文章Ubuntu ssh远程登录分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/30947.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注