Sftp cmd

What is the cmd line to connect sftp, specifing the port number and the shh key file.

When I use the below cmd format, it gives the msg :node name or service name not known, but I know the connection works, because the automated sftp script works fine and I can log into the remote server

sftp -o port=??? IdentityFile=/your/private/key user@sftpserver

Use the -o option a second time

sftp -o Port=xxxx -o IdentityFile=/your/private/key user@sftpserver

using the -o option twice works, what is the use of using the -o twice.

Also thx for the solution.

The -o option is used to pass one option to the sftp-command. You need two of them, so you need two -o .

You also could put the options in your ~/.ssh/config file, so you don't have to pass them on the command line:

Host sftpserver
    Port xxxx
    IdentityFile /your/private/key

---------- Post updated at 16:31 ---------- Previous update was at 16:26 ----------

You even can add the username

Host sftpserver
    Port xxxx
    IdentityFile /your/private/key
    User user

then all you need on the commandline is

sftp sftpserver