使用ssh 连接linux 并传送文件
1、 在windows下使用ssh连接linux
①、连接
输入 ssh 用户名@IP 例如:ssh root@192.168.0.232
[C:\~]$ ssh root@192.168.0.232Connecting to 192.168.0.232:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.root@okmx8mm:~# ls -al
total 332728
drwxr-xr-x 3 root root 4096 Jun 21 09:20 .
drwxr-xr-x 4 root root 4096 Mar 29 2022 ..
-rw------- 1 root root 554 Jun 21 10:11 .bash_history
-rw-r--r-- 1 root root 51 Mar 29 2022 .profile
drwx------ 2 root root 4096 Jun 21 09:15 .ssh
-rw-r--r-- 1 root root 963 Jun 21 09:21 result.log
-rwxrwxrwx 1 root root 711 Jun 21 09:20 tem.sh
-rw-r--r-- 1 root root 340672512 Jun 20 10:39 test.bin
-rwxrwxrwx 1 root root 726 Jun 20 10:02 test.sh
-rw-r--r-- 1 root root 3689 Jun 21 09:21 vmstat.log
root@okmx8mm:~#
可以看到,已经正常链接了。
②、传送文件
要传送文件,不能在已经连接的终端上执行,首先要退出ssh链接。
拷贝linux下的/home/root/tem.sh 到e:\
[C:\~]$ scp root@192.168.0.232:/home/root/tem.sh e:\Connecting to 192.168.0.232:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Start scp session to download.
tem.sh 711 字节
Connection closing...Socket close.
Connection closed by foreign host.
Disconnected from remote host(192.168.0.232:22) at 16:42:41.
Type `help' to learn how to use Xshell prompt.
[C:\~]$ dir e:\驱动器 E 中的卷是 tools卷的序列号是 0008-319De:\ 的目录2021/11/24 周三 14:31 <DIR> 1012vmware
2022/01/14 周五 14:21 <DIR> 1028
2022/01/14 周五 13:07 <DIR> 335xd
2021/11/30 周二 09:35 <DIR> 6ull-s2
2022/04/12 周二 11:51 <DIR> 999、tool
2021/11/30 周二 15:15 <DIR> share
2022/04/19 周二 16:42 711 tem.sh
2022/01/14 周五 17:28 <DIR> 以前的资料
2022/04/18 周一 11:25 <DIR> 本机必备工具1 个文件 711 字节8 个目录 82,128,781,312 可用字节
可以看到 tem.sh 已经拷贝到e:\ 下面了。
拷贝e:\tem.sh 到linux下/home/root/tem1.sh
C:\~]$ scp e:\tem.sh root@192.168.0.232:/home/root/tem1.sh Connecting to 192.168.0.232:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Start scp session to upload.
tem.sh 711 字节
Sent all of files.
Connection closing...Socket close.
Connection closed by foreign host.
Disconnected from remote host(192.168.0.232:22) at 16:45:17.
Type `help' to learn how to use Xshell prompt.
[C:\~]$ ssh root@192.168.0.232Connecting to 192.168.0.232:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.root@okmx8mm:~# pwd
/home/root
root@okmx8mm:~# ls -al
total 332732
drwxr-xr-x 3 root root 4096 Jun 21 10:18 .
drwxr-xr-x 4 root root 4096 Mar 29 2022 ..
-rw------- 1 root root 566 Jun 21 10:15 .bash_history
-rw-r--r-- 1 root root 51 Mar 29 2022 .profile
drwx------ 2 root root 4096 Jun 21 09:15 .ssh
-rw-r--r-- 1 root root 963 Jun 21 09:21 result.log
-rwxrwxrwx 1 root root 711 Jun 21 09:20 tem.sh
-rw-r--r-- 1 root root 711 Jun 21 10:18 tem1.sh
-rw-r--r-- 1 root root 340672512 Jun 20 10:39 test.bin
-rwxrwxrwx 1 root root 726 Jun 20 10:02 test.sh
-rw-r--r-- 1 root root 3689 Jun 21 09:21 vmstat.log
root@okmx8mm:~#
可以看到已经拷贝到/home/root/,并且名称为tem1.sh
2、 在linux下使用ssh连接linux
相对于windows下,linux下使用要方便一点,因为两边都是linux系统。
①、连接
forlinx@ubuntu:~$ ssh root@192.168.0.232
The authenticity of host '192.168.0.232 (192.168.0.232)' can't be established.
ECDSA key fingerprint is SHA256:0jqQj0TgVF6Q+imwCHDfwZ4GfsJdM+u0G20Dc9Kwkn4.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added '192.168.0.232' (ECDSA) to the list of known hosts.
root@192.168.0.232's password:
Welcome to NXP LSDK 2004 main (GNU/Linux 5.4.3 aarch64)* Support: https://www.nxp.com/lsdk* Documentation: https://lsdk.github.io/document* Licensing: https://lsdk.github.io/eula
Last login: Sat Apr 9 07:00:36 2022 from 192.168.0.200
root@forlinx:~#
root@forlinx:~#
root@forlinx:~# ls
bj.sh led.sh r.sh tc.sh testusb.sh
downnet.sh log result.txt test.log testusb1.sh
getmax.sh main stress.sh testmem.sh testusb2.sh
②、传送文件
下载文件:
下载文件
scp username@servername:/path/filename /var/www/local_dir(本地目录)
forlinx@ubuntu:~$ scp root@192.168.0.232:/root/bj.sh /
root@192.168.0.232's password:
/bj.sh: Permission denied
forlinx@ubuntu:~$ sudo scp root@192.168.0.232:/root/bj.sh /
[sudo] password for forlinx:
The authenticity of host '192.168.0.232 (192.168.0.232)' can't be established.
ECDSA key fingerprint is SHA256:0jqQj0TgVF6Q+imwCHDfwZ4GfsJdM+u0G20Dc9Kwkn4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.232' (ECDSA) to the list of known hosts.
root@192.168.0.232's password:
bj.sh 100% 215 121.8KB/s 00:00
forlinx@ubuntu:~$
forlinx@ubuntu:~$
forlinx@ubuntu:~$ ls /
bin dev initrd.img.old libx32 opt sbin sys vmlinuz
bj.sh etc lib lost+found proc snap tmp vmlinuz.old
boot home lib32 media root srv usr
cdrom initrd.img lib64 mnt run swapfile var
forlinx@ubuntu:~$
上传文件
scp /path/filename username@servername:/path forlinx@ubuntu:~$ sudo scp /bj.sh root@192.168.0.232:/root/1/
root@192.168.0.232's password:
bj.sh 100% 215 149.1KB/s 00:00
forlinx@ubuntu:~$
创作不易,欢迎点赞、关注。
–好记性不如烂笔头。
使用ssh 连接linux 并传送文件相关推荐
- ssh连接Linux很慢,且ssh传输文件很慢的解决方案
ssh连接Linux很慢,且ssh传输文件很慢的解决方案 网上关于该问题的常用解决方法是(主要就是修改配置文件/etc/ssh/sshd_config): (1)修改"UseDNS" ...
- 远程往服务器上传送文件,远程连接服务器怎么传送文件
远程连接服务器怎么传送文件 内容精选 换一换 代码迁移工具进行代码迁移时,需要调用Linux下的rpm.deb等命令才能完成扫描和迁移相关任务,这些命令和逻辑必须在后端Linux运行.插件只支持以We ...
- Loadrunner通过ssh连接linux进行hadoop基准测试
版权声明:本文为博主原创文章,未经博主允许不得转载.欢迎访问我的博客 https://blog.csdn.net/smooth00/article/details/73796622 Loadrunne ...
- linux ssh抓包,如何在SSH连接Linux系统的环境下使用wireshark抓包?
TSINGSEE青犀视频云边端架构EasyNVR.EasyDSS.EasyGBS等都是有两种操作系统的版本,一种是linux,一种是windows.而大多数开发者用户都会使用linux版本进行安装. ...
- SSH连接Linux CentOS7-Putty篇
SSH连接Linux CentOS7-Putty篇 这是第一次使用Putty 利用SSH连接Linux.如果你想学习如何使用配置私钥在本地连接Linux服务器, 可以仔细阅读这篇文章,了解一下有关本地 ...
- wireshark linux远程,如何在SSH连接Linux的环境下使用wireshark抓包云边端架构?
原标题:如何在SSH连接Linux的环境下使用wireshark抓包云边端架构? TSINGSEE青犀视频云边端架构EasyNVR.EasyDSS.EasyGBS等都是有两种操作系统的版本,一种是li ...
- ssh连接服务器FTP传不了文件,ssh连接服务器FTP传不了文件
ssh连接服务器FTP传不了文件 内容精选 换一换 Atlas 200 DK开发者板支持通过USB端口或者网线与Ubuntu服务器进行连接,连接示例图如图1所示.Atlas 200 DK连接Ubunt ...
- Visual Studio Code——SSH连接Linux
Visual Studio Code--SSH连接Linux 记录使用连接linux服务器 一.连接远程服务器 安装插件工具 名称: Remote - SSH 二.修改扩展文件 我这里直接把扩展文件修 ...
- VScode使用SSH连接Linux(Ubuntu)系统程序开发,详细教程
VScode使用SSH连接Linux(Ubuntu)系统程序开发,详细教程 VScode使用SSH连接Linux(Ubuntu)系统程序开发 1.安装SSH 2.SSH连接远程服务器 3.远程编程开发 ...
最新文章
- C#精粹,一本都不能少
- UVA11384正整数序列(把123..变成0的最小步数)
- Ran out of input
- python取出字典中的所有值的两种方法
- 一步一步学Remoting
- java抽象类与接口5.4-5.7 2020.3.31
- MongoDB最简单的入门教程之三 使用Java代码往MongoDB里插入数据
- java resources 目录_[Java] 在 jar 文件中读取 resources 目录下的文件
- android仿大众点评,仿大众点评android源码
- 做游戏怎能没有马云马化腾?
- 中国银保监会公布银行业金融机构目前共有4608家(附全部名录)
- 二级C语言选择题分类,全国计算机等级考试二级C语言填空与选择题简单分类.doc...
- 数据结构 复习攻略 新手必看
- KEIL中加入GD设备文件
- 中国的粮食储备,多的远超你想象,抢粮的人纯粹是傻冒
- c语言max函数是什么,什么是C语言函数
- 解决git克隆到本地的仓库文件夹不显示红色感叹号、绿色对号等图标的问题
- cpu性能诊断工具turbostat详解
- OSChina 周日乱弹 —— 你撞鬼了吗?
- pandas学习笔记1—categories与set_categories