Docs · Clients

OpenSSH sftp command: connect and upload from scripts

The sftp command ships with OpenSSH on Linux, macOS and Windows 10 and later. With the host keys saved and StrictHostKeyChecking on, it never asks to trust an unknown server.

These steps use the SFTP Harbor endpoint data.sftpharbor.com and the example login yourserver.alice: your server's name, a dot, and the user name. Signed-in customers see the same steps with their own login on the dashboard's overview.

Save the published host keys once. With StrictHostKeyChecking=yes, sftp refuses any other key instead of asking.

Save the host keys
mkdir -p ~/.ssh
cat > ~/.ssh/harbor_known_hosts <<'EOF'
data.sftpharbor.com ssh-ed25519 …
EOF
Connect
sftp -o UserKnownHostsFile=~/.ssh/harbor_known_hosts -o StrictHostKeyChecking=yes -i ~/.ssh/id_ed25519 yourserver.alice@data.sftpharbor.com
Upload from a script
sftp -b - -o UserKnownHostsFile=~/.ssh/harbor_known_hosts -o StrictHostKeyChecking=yes -i ~/.ssh/id_ed25519 yourserver.alice@data.sftpharbor.com <<'EOF'
put report.csv
EOF

Host keys are also listed on the security page, with SSHFP records. When keys are rotated, the new ones are announced 30 days ahead and included above.