Linux sftp windows 文件上传和下载

1.windows sftp windows没问题;

2.linux sftp window报错:

dev@ilpt41:~$ sftp -oPort=2201 test@192.168.1.4 Unable to negotiate with 192.168.1.4 port 2201: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1 Connection closed. Connection closed dev@ilpt41:~$

3.解决方法:

a.进入vi编辑器,编辑或建立文件名:vi ~/.ssh/config

b.按i进入插入模式然后输入:

host 192.168.1.4 port 2201 KexAlgorithms +diffie-hellman-group1-sha1

c.输入完成后,按esc推出插入模式,然后输入

:wq保存并推出vi编辑器。(:wq表示保存并退出,:q!表示不保存并退出)

cat ~/.ssh/config 查看刚保存的文件内容

4.下载:

get ./tests/texts.txt ./testc/

//get 远程路径/文件名 本地路径

5.上传:

put ./testc/textc.txt ./tests

//put 本地路径/文件名 远程路径

经验分享 程序员 微信小程序 职场和发展