Ubuntu ssh远程登录

前言

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
  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值