Use the following command to connect to an SFTP dropbox using public key authentication. Common locations for private key files include ~/.ssh/id_rsa
and ~/.ssh/id_ed25519
.
sftp -o PreferredAuthentications=publickey -o PubkeyAuthentication=yes -o PasswordAuthentication=no -o HostKeyAlgorithms=+ssh-rsa -i /path/to/private/key -P 19321 [email protected]
In the command above, we're using the sftp command with various options:
-o PreferredAuthentications=publickey: Specifies that the preferred authentication method is public key.
-o PubkeyAuthentication=yes: Enables public key authentication.
-o PasswordAuthentication=no: Disables password authentication.
-i /path/to/private/key: Specifies the path to your private key file, e.g. `~/.ssh/id_rsa` or `~/.ssh/id_ed25519`
-P 19321: Specifies the custom port number (in this example, 19321) to be used for the SFTP connection. Replace it with the actual port number used by your SFTP server.
[email protected]: Specifies the username and hostname or IP address of your SFTP server.
The following settings have not been tested.
# File: ~/.ssh/config
.
.
.
Host *.google.com
HostName partnerupload.google.com
Port 19321
User myusername
HostkeyAlgorithms +ssh-rsa
IdentityFile ~/.ssh/id_rsa
PubkeyAuthentication yes
PasswordAuthentication no
PreferredAuthentications publickey
.
.
.
publickey
should go before password
.
# File: /private/etc/ssh/ssh_config
.
.
.
Host *
PreferredAuthentications publickey,password,keyboard-interactive,hostbased,gssapi-with-mi
.
.
.