ssh 复制本地文件到服务器失败

ssh failed to copy local files to the server

我已经连接到服务器并且我是root用户,但是我的命令失败了

scp -p 10010 ~/Desktop/usb.sh root@localhost:/

错误:

ssh: connect to host localhost port 22: Connection refused

您需要 大写字母 P (-P) 来指定端口,来自手册页: scp (1):

-P port

Specifies the port to connect to on the remote host. Note that this option is written with a capital 'P', because -p is already reserved for preserving the times and modes of the file in rcp(1).


此外,请确保您的用户可以写入文档根目录 (/),您始终可以写入您的主文件夹:(root@localhost:/root/)


固定命令:

scp -P 10010 ~/Desktop/usb.sh root@localhost:/