SFTP Connection Testing
In order to test SFTP connection to a remote server you need to execute
connect test sftp
followed by two mandatory parameters:
-h, --host
then the remote IP-l, --login
then remote SFTP user login
Depending on the type of authentication you need to either use -p, --password
or --password-file
for password based authentication
or the -i, --identity-file
for key based authentication.
Password based authentication
Section titled “Password based authentication”If you use password based authentication you need to provide:
-p, --password
then the SFTP user password
For example:
$ connect test sftp -h 10.0.0.24 -l monitor01 -p password2025/05/19 17:53:42 INFO Connection successful
Application can also prompt you for a password. Just put -p -
.
$ connect test sftp -h 10.0.0.24 -l monitor01 -p -Enter Password:2025/05/19 17:59:11 INFO Connection successful
To secure the solution it’s also possible to provide the password stored in a file with --password-file
and
then the file containing the password.
$ connect test sftp -h 10.0.0.24 -l monitor01 --password-file password-file2025/05/19 18:00:50 INFO Connection successful
Key based authentication
Section titled “Key based authentication”If you’d like to use SSH key based authentication you need to provide:
-i, --identity-file
then the private SSH key
For example:
$ connect test sftp -h 10.0.0.24 -l monitor01 -i .ssh/id_ed255192025/05/19 18:03:17 INFO Connection successful
If your key is password protected you can provide the password using:
-k, --identity-passphrase
then the optional password to the private key
$ connect test sftp -h 10.0.0.24 -l monitor01 -i .ssh/id_ed25519 -k password2025/05/19 18:0:17 INFO Connection successful
Application can also prompt you for the key password. Just put -k -
.
$ connect test sftp -h 10.0.0.24 -l monitor01 -i .ssh/id_ed25519 -k -Enter Private Key Passphrase:2025/05/19 18:05:37 INFO Connection successful
To secure the solution it’s also possible to provide key password stored in a file with --identity-passphrase-file
and then the file containing the password to the key.
$ connect test sftp -h 10.0.0.24 -l monitor01 -i .ssh/id_ed25519 --identity-passphrase-file passphrase-file2025/05/19 18:06:38 INFO Connection successful
SFTP listening on non-standard port
Section titled “SFTP listening on non-standard port”Optionally you can specify the target port the remote server is listening on (if it’s different than 22/TCP
).
--port
then the target TCP port
For example, below tests the connection to sftp://[email protected]
port 2222/TCP
.
$ connect test sftp -h 10.0.0.24 -l monitor01 -p password --port 22222025/05/19 18:14:24 INFO Connection successful
Timeout
Section titled “Timeout”There’s an optional parameter to set the timeout for network operations.
By default it’s set to 30s
however for servers on a local network you may wish to reduce the timeout
and for slow servers or servers far away you may wish to extend the timeout.
--timeout
number of seconds
Below example tests the connection to sftp://[email protected]
with network timeout set to 1s
:
$ connect test sftp -h 10.0.0.24 -l monitor01 -p password --timeout 12025/05/19 18:16:43 INFO Connection successful
All SFTP Connection Test Options
Section titled “All SFTP Connection Test Options”Usage: connect test sftp [command] [flags]
Flags: -h, --host string Destination sftp host -i, --identity-file string Private key file to use for authentication -k, --identity-passphrase string Private key passphrase --identity-passphrase-file string Private key passphrase file --idle uint Timeout for no network activity in seconds (default 60) -l, --login string Destination sftp host login -p, --password string Destination sftp host password --password-file string Destination sftp host password file --port uint Destination sftp host port (default 22) -t, --timeout uint Timeout for network operations in seconds (default 30)
Global Flags: --godebug Turns on debug mode --help Prints help for the command --log-format string Log output format: text|json (default "text") --no-color Do not use colors in logs --quiet Makes no output
Errors
Section titled “Errors”Please check here for information on the possible errors.