Showing results for 
Search instead for 
Did you mean: 

Sftp with SSH

Daryl Much
Frequent Advisor

Sftp with SSH

Hello, I have created a process that uses sftp to connect to a remote system and authnticates with a key that I generated with ssh-keygen. The key is named id-dsa. When I watch the process with a -v i see it check parse a list of keys and it gets to that particular one can accepts it. My question is how do I hav a key named something other then id_dsa to be offered by the server? Thanks
Suraj K Sankari
Honored Contributor

Re: Sftp with SSH

see this
you can give dsa or rsa
Steps: For SSH Without a Password

On the client run the following commands:
$ mkdir -p $HOME/.ssh
$ chmod 0700 $HOME/.ssh
$ ssh-keygen -t dsa/rsa -f $HOME/.ssh/id_d sa -P ''

This should result in two files,
$HOME/.ssh/id_dsa/rsa (private key) & $HOME/.ssh/ (public key).
Copy $HOME/.ssh/ to the server.

On the server run the following commands:
$ mkdir -p $HOME/.ssh
$ cat >> $HOME/.ssh/authorized_keys2
$ chmod 0600 $HOME/.ssh/authorized_keys2

Depending on the version of OpenSSH the following commands may also be required:
$ cat >> $HOME/.ssh/authorized_keys
$ chmod 0600 $HOME/.ssh/authorized_keys

An alternative is to create a link from authorized_keys2 to authorized_keys:
$ cd $HOME/.ssh && ln -s authorized_keys2 authorized_keys

On the client test the results by ssh'ing to the server:
$ ssh -i $HOME/.ssh/id_dsa/rsa server

(Optional) Add the following $HOME/.ssh/config on the client:
Host server
IdentityFile ~/.ssh/id_dsa
This allows ssh access to the server without having to specify the path to the id_dsa/rsa file as an argument to ssh each time

Steven E. Protter
Exalted Contributor

Re: Sftp with SSH


It would be easier to use scp for the file transfer. Also part of the openssh package which includes ssh sftp and scp

Steven E Protter
Owner of ISN Corporation
Steven Schweda
Honored Contributor

Re: Sftp with SSH

> [...] When I watch the process with a -v i
> see it [...]

That's nice, but we can't see what you see
unless you show it to us.

> [...] offered by the server?

Offered _by_ the server or _to_ the server?

I may not understand what you want. Are you
looking for something like "-i file" for
"ssh"? If so, sftp probably has a way to let
you specify the same thing.

It might also help if you mentioned your OS
version, and, perhaps, your SSH and/or SFTP