cancel
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
3 REPLIES
Suraj K Sankari
Honored Contributor

Re: Sftp with SSH

hey,
see this
you can give dsa or rsa
Client
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/id_dsa.pub (public key).
Copy $HOME/.ssh/id_dsa.pub to the server.

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

Depending on the version of OpenSSH the following commands may also be required:
$ cat id_dsa.pub >> $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

Suraj
Steven E. Protter
Exalted Contributor

Re: Sftp with SSH

Shalom,

http://www.hpux.ws/?p=10

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

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
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
version(s).