Linux下ssh环境的搭建及使用

1、查看是否开启ssh服务:

sudo ps -e | grep ssh

2、查看是否安装了ssh服务:

sudo service ssh start

若没有安装,终端打印以下信息:

:~$ sudo service ssh start
Failed to start ssh.service: Unit ssh.service not found.

3、安装ssh服务:

sudo apt-get install openssh-server

4、开启、关闭及运行状态查询

service ssh start/stop/status

5、ssh登录远端 ssh 用户名@IP -p portid

:~$ ssh nvidia@192.168.1.66 -p 22
The authenticity of host '192.168.1.66 (192.168.1.66)' can't be established.
ECDSA key fingerprint is SHA256:oTgKigtyuJgE0GInUM9EkZObS6bfjvfr2ENHU7j+1wE.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.66' (ECDSA) to the list of known hosts.
nvidia@192.168.1.66's password: 
Welcome to Ubuntu 16.04 LTS (GNU/Linux 4.4.38-tegra aarch64)

 * Documentation:  https://help.ubuntu.com/

628 packages can be updated.
314 updates are security updates.

Last login: Sat Apr 28 05:41:40 2018
nvidia@tegra-ubuntu:~$ exit
logout
Connection to 192.168.1.66 closed.

6、ssh复制文件scp

本地->远端(复制文件): 
scp LocalFile  UserName@RemoteIP:RemoteFile
本地->远端(复制目录): 
scp -r LocalFolder UserName@RemoteIP:RemoteFolder
远端->本地(复制文件): 
scp UserName@RemoteIP:RemoteFile LocalFile 
远端->本地(复制目录): 
scp -r UserName@RemoteIP:RemoteFolder LocalFolder
远端->远端(复制文件,从1复制到2) : 
scp UserName1@RemoteIP1:RemoteFile1 UserName2@RemoteIP2:RemoteFile2
远端->远端(复制目录,从1复制到2:
scp -r UserName1@RemoteIP1:RemoteFolder1 UserName2@RemoteIP2:RemoteFolder2
:/media/.../新加卷/Document/Sensor/Tx2$ \
scp LKT4303txt-Download.tar.gz nvidia@192.168.1.66:/home/nvidia/lkt4303/LKT4303txt-Download.tar.gz
nvidia@192.168.1.66's password: 
LKT4303txt-Download.tar.gz                    100%   15KB  14.7KB/s   00:00    
:/media/.../新加卷/Document/Sensor/Tx2$ 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值