Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use scp URI with different port?

Tags:

scp

ssh

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

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

But I changed my ssh port to 3131. How can I fetch and append the ssh port to the scp command?

like image 733
yayantritaryana Avatar asked Jan 07 '13 07:01

yayantritaryana


1 Answers

Beginning with version 7.7, The commonly-used scp command-line utility accepts URL as a command-line argument. The common way to specify a port number in a URL is following the hostname:

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

Alternately, scp has a -P option to specify a port:

scp -P 3131 root@host:/root/ids/rules.tar.gz .
like image 87
Kenster Avatar answered Oct 10 '22 18:10

Kenster