测试环境:
CentOS 8.5
Windows 10
特殊说明:
CentOS安装的是8.1,然后升级到8.5。选择带GUI的服务器。
在CentOS上安装SSH,即可实现Linux和Windows间互相传递文件。
CentOS 8.1默认自带SSH软件包,假如没有安装请按下面的步骤安装:
su root
yum install openssh-server
yum install openssh-clients
启动服务
systemctl start sshd
上面没有实际测试!
putty
Download PuTTY: latest release (0.76) (greenend.org.uk)https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html下载putty.zip,这里包含所有的exe。不用单独下。
从windows向linux传递文件使用pscp.exe
pscp d:\test.txt work1@1.1.1.1:/home/work1 拷贝文件
pscp -r d:\test work1@1.1.1.1:/home/work1 拷贝文件夹
将work1为访问CentOS的用户名,1.1.1.1为目标机的IP地址
psftp命令能实现windows和linux间互相传递文件
psftp.exe
open 1.1.1.1
输入用户
输入密码
get -r /home/work1/test 将文件夹/home/work1/test下载到本地
get /home/work1/test.txt 将/home/work1/test.txt文件下载到本地
put -r d:/test/ /home/work1/test 将d:\test上传到/home/work1下
put d:/test.txt /home/work1 将d:\test.txt文件上传到/home/work1下
psftp使用说明
! run a local command
bye finish your sftp session
cd change your remote working directory
chmod change file permissions and modes
close finish your sftp session but do not quit psftp
del delete files on the remote server
dir list remote files
exit finish your sftp session
get download a file from the server to your local machine
help give help
lcd change local working directory
lpwd print local working directory
ls list remote files
mget download multiple files at once
mkdir create directories on the remote server
mput upload multiple files at once
mv move or rename files on the remote server
open connect to a host
put upload a file from your local machine to the server
pwd print your remote working directory
quit finish your sftp session
reget continue downloading files
ren move or rename files on the remote server
reput continue uploading files
rm delete files on the remote server
rmdir remove directories on the remote server