I am trying to use sshpass with port number.
sshpass -p "somepassword" scp someuser@12.12.12.12/somefile /somefolder
how to pass port number to sshpass ?
>Solution :
To use sshpass with a port number, you can specify the port using the -P option. Here’s how you can modify your command:
sshpass -p "somepassword" scp -P <port_number> someuser@12.12.12.12:/somefile /somefolder
Replace <port_number> with the actual port number you want to use. For example, if the port number is 2222, the command would be:
sshpass -p "somepassword" scp -P 2222 someuser@12.12.12.12:/somefile /somefolder
This will allow you to use sshpass with a specific port number for SCP.
The -P option in scp is used to specify the port number, and it is different from the -p option in sshpass. The -P option in scp is case-sensitive and should be in uppercase.
The default SSH port is 22, but you can specify a different port using the -P option in scp when using sshpass