How to use scp URI with another port?

I want to automate copying using scp . If I use the default ssh port, the URI will look like this:

 scp:// root@host :/root/ids/rules.tar.gz 

But I changed my ssh port to 3131 . How can I get and add ssh port to scp command?

+4
source share
2 answers

The commonly used scp command-line utility does not accept the URL as a command-line argument, so it does not figure out which program you are using here. Having said that, the general way to specify the port number in the URL matches the host name:

 scp:// root@host :3131/root/ids/rules.tar.gz ^^^^ 

If you have a scp utility that accepts a url, probably as you pointed it out.

If you use a typical scp command-line utility, you can run something like this:

 scp -P 3131 root@host :/root/ids/rules.tar.gz . 

But you are not actually using the url.

+5
source

You can use scp -P to command

+1
source

All Articles