Operating System - HP-UX
1830895 Members
1472 Online
110017 Solutions
New Discussion

SFTP without prompting password

 
SOLVED
Go to solution
Dewa Negara_4
Regular Advisor

SFTP without prompting password

Hi All,

Pls help. My customer's requesting to use SFTP to transfer some files regularly from serverA to serverB using a simple script. Because public/private keys policy is not so clear in my company, so we avoid to use public/private keys. Is there any way to use SFTP without prompting a password except using public/private key? FYI that I have tried to use .netrc, but it seems like .netrc is only for ftp and it is not applicable for sftp.

Please help. High score will be given.

Thanks and Best Regards,
Negara
Santos
3 REPLIES 3
Simon Hargrave
Honored Contributor

Re: SFTP without prompting password

The best way is to use public/private key, however you can also script it with newer version of kermit, which has ssh functionality built in.
Dewa Negara_4
Regular Advisor

Re: SFTP without prompting password

Thanks.

Is there any way wihtout prompting password except public/private keys?

Santos
Gary L. Paveza, Jr.
Trusted Contributor
Solution

Re: SFTP without prompting password

I'm fairly positive that you will need keys.

However it's easy.

Let's assume userA is the user who will performing the sftp action (whether it be put or get).

userA needs to create a set of keys - but the key is to make them passwordless.

ssh-keygen -t (keytype - either rsa or dsa)

It will prompt you for key location - just press enter

It will prompt for passphrase. Press enter twice here - this will make it passwordless.

UserA will now have a diretory ~/.ssh which contains two files. Assuming you used an rsa key, the files are id_rsa.pub and id_rsa.

Let's assume that userB is the remote system. You will need to transfer userA's ~/.ssh/id_rsa.pub file to userB's ~/.ssh/authorized_key file. If userB already has a ~/.ssh/authorized_key file, simply append the file.

To test, as userA:

ssh date