Private Key with Passphrase - WeOnlyDo Discussion board

Private Key with Passphrase (General questions)

by Swanand, Thursday, April 14, 2005, 12:40 (6975 days ago)

Hi,
I have generated a private key using ssh-keygen in included in OpenSSH package with a PASSPHRASE . Now I load key file and connect to server. It is not connecting. Can you provide the correct steps / syntax to do this. That is how to include passphrase while using wodSFTP for connecting to SFTP server?

-Swanand

Re: Private Key with Passphrase

by wodSupport, Thursday, April 14, 2005, 14:56 (6974 days ago) @ Swanand

Swanand,

did you manage to connect to the server with any other client, such as SSH package you used to generate the key? Did you paste public key on the server in authorized_keys file?

This always depends on the server on how to do it. If server is OpenSSH, then load the key with wodKeys (using Load method), use PublicKeyOpenSSH property to retrieve public key, and then paste that public key (it will look like ssh-rsa AAA.... ) to your home directory in subfolder ./ssh/authorized_keys2. That should work.

Re: Private Key with Passphrase

by Swanand, Tuesday, April 19, 2005, 05:53 (6970 days ago) @ wodSupport

Hi
I did all you said. Thanks for that. It is working but I am not able to putFile on the server. Whereas I am able to getFile from server also I am able to make directories on server. SFTP does not throw any error when I execute putFile but the file does not reach the server

-Swanand

Swanand,

did you manage to connect to the server with any other client, such as SSH package you used to generate the key? Did you paste public key on the server in authorized_keys file?

This always depends on the server on how to do it. If server is OpenSSH, then load the key with wodKeys (using Load method), use PublicKeyOpenSSH property to retrieve public key, and then paste that public key (it will look like ssh-rsa AAA.... ) to your home directory in subfolder ./ssh/authorized_keys2. That should work.

Re: Private Key with Passphrase

by Swanand, Wednesday, April 20, 2005, 05:53 (6969 days ago) @ Swanand

Hi,
I am facing a very strange problem. I am able to receive file from server. I am able to append to an existing file on the server. I can also send a file to server if the same name file already exists on the server. But if a file of same name does not exist on the server then I am not able to send the file to server using PutFile API. I am not sure what is going wrong. The error that I get back is
30018, Server returned an error. No such file exists . Whereas if I try putting the same file from command prompt, the file gets transferred.
Anybody knows what can give rise to such and error?

-Swanand

Re: Private Key with Passphrase

by wodSupport, Wednesday, April 20, 2005, 08:10 (6969 days ago) @ Swanand

Did you specify full path of remote file?

Re: Private Key with Passphrase

by Swanand, Wednesday, April 20, 2005, 08:49 (6969 days ago) @ wodSupport

I am sending my code snippet please see that and tell me if I have done anything wrong
Set SFTP1 = New wodSFTPCom
.
. ''Setting etc.
.
SFTP1.Connect
SFTP1.Blocking = True
SFTP1.PutFile d:B.txt , d:swanand
SFTP1.PutFile d:B.txt , d:swanandB.txt
SFTP1.PutFile d:B.txt , d:swanand
' None of the above work
' If on target machine there is a file named B.txt at location
' D:swanand then all of above work
SFTP1.Disconnect

Following is the error message I get

Run-time error '30018'
Server returned an error: No such file or directory

If you can revert early it will help me a lot

Re: Private Key with Passphrase

by wodSupport, Wednesday, April 20, 2005, 12:07 (6969 days ago) @ Swanand

Please move Blocking = True prior to calling Connect.

Do you specify full paths when you use PutFile? I don't see if you use \ or / at the front of paths. Remember - when accessing remote file you must always use full path, such as

/home/joe/file.txt

Can you make sure you do that?

Re: Private Key with Passphrase

by wodSupport, Wednesday, April 20, 2005, 12:08 (6969 days ago) @ wodSupport

One more thing - not sure which server is on the remote side, but I doubt it will allow you to use D:\swanand\ path... Usually they provide paths as on UNIX, starting with / .

Re: Private Key with Passphrase

by Swanand, Thursday, April 21, 2005, 05:29 (6968 days ago) @ wodSupport

Thanks Unix style path got it going,
The server on the other side is a Win2K machine hosting OpenSSH SFTP server. NT style path (D:\swanand\) works for all purpose but for PutFile only unix style path (/home/swanand) seems to work. It is working for me now. I have one last question. The kind of path to be used depend on the server machine of the software running on the server. I was thinking since the server on the other side id Win2K box, NT style path would work and it does work for all purpose but PutFile.

-Swanand

Re: Private Key with Passphrase

by wodSupport, Thursday, April 21, 2005, 07:56 (6968 days ago) @ Swanand

Well, you know that saying 'works for all purpose' doesn't really stand - it's all up to the service used, right?

SFTP is much different than SMB sharing, it's more like old FTP. And FTP protocol also doesn't have D:\, it uses UNIX approach, and SFTP comes from same world (UNIX).