我试图scp文件从远程服务器到我的本地机器。只有80端口可访问。
我试着:
scp -p 80 username@www.myserver.com:/root/file.txt .
cp: 80:没有这样的文件或目录
如何在scp命令中指定端口号?
我试图scp文件从远程服务器到我的本地机器。只有80端口可访问。
我试着:
scp -p 80 username@www.myserver.com:/root/file.txt .
cp: 80:没有这样的文件或目录
如何在scp命令中指定端口号?
当前回答
这可以通过-P开关指定port来实现:
scp -i ~/keys/yourkey -P2222 file ubuntu@host:/directory/
其他回答
这可以通过-P开关指定port来实现:
scp -i ~/keys/yourkey -P2222 file ubuntu@host:/directory/
如果需要将本地文件复制到服务器(指定端口)
scp -P 3838 /the/source/file username@server.com:/destination/file
如果要在scp命令上使用另一个端口,请像这样使用大写P
scp -P port-number source-file/directory user@domain:/destination
是的,阿里
希望这对寻找完美答案的人有所帮助
将具有定义端口的服务器上的文件夹或文件复制到另一台服务器或本地计算机
转到您有管理权限的目录,最好是您想要复制文件的机器上的主目录 编写下面的命令
scp -r -P port user@IP_address:/home/file/pathDirectory。
**Note:** The last . on the command directs it to copy everything in that folder to your directory of preference
复制文件到主机: scp SourceFile remoteuser@remotehost:/directory/TargetFile . xml
从主机复制文件: scp user@host:/directory/SourceFile目标文件
从主机递归复制目录: scp -r user@host:/directory/SourceFolder目标文件夹
注意:如果主机使用的端口不是22,可以使用-P选项指定: scp -P 2222 user@host:/directory/SourceFile目标文件