![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SSH with a --password command line??? | jjinno | UNIX for Dummies Questions & Answers | 5 | 02-29-2008 05:57 AM |
| Entering secret password | chiru_h | Shell Programming and Scripting | 4 | 08-20-2007 02:31 PM |
| Remote Copy without entering Username and Password | ilak1008 | UNIX for Dummies Questions & Answers | 1 | 01-11-2006 04:00 AM |
| Entering directories structured above user. | Frank Hunter | UNIX for Dummies Questions & Answers | 9 | 02-03-2005 01:24 PM |
| entering a long command | hedrict | UNIX for Dummies Questions & Answers | 1 | 06-29-2001 06:31 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to use SFTP from command line without entering user and password
I would like to use SFTP from command line without entering userid and password.
Here is what I have gathered and did. 1) Create a public and private key pair for the protocol you want to use. To create a key pair for use by SSH2, enter: ssh-keygen -t dsa I did that and got following message Enter file in which to save the key (/home/user1/.ssh/id_dsa): /home/user1/.ssh/id_dsa Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/user1/.ssh/id_dsa. Your public key has been saved in /home/user1/.ssh/id_dsa.pub. The key fingerprint is: 71:f5:3d:8f:ae:2a:73:9c:79:92:b0:35:ca:9a:2f:ed I did not enter a passphrase 2) Next step I did was copied this file to a remote machine to which I want to connect like this scp /home/user1/.ssh/id_dsa user2@machine2:/home/user2/.ssh/authorized_keys Now I logged out from user1@machine1 and user2@machine2 and then just write following lines in a korn shell script: sftp machine2 put test_file but it asks for password for user2 on machine2. So what else am I missing??? |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
I copied the id_dsa.pub key to authorized keys and now scp works
but I still get following error for SFTP machine1[/home/user1] ==> machine1[/home/user1] ==>sftp ~/SFTP_test_file machine2:/home/user2/ftptest Connecting to /home/user2/SFTP_test_file... ssh: /home/user2/SFTP_test_file: no address associated with name Connection closed machine1[/home/user1] ==> machine1[/home/user1] ==> ======================= However this is the public key which I don't want to use. I want to use the private key so that noone else can log in. |
|
#3
|
||||
|
||||
|
Quote:
Regards. |
|
#4
|
||||
|
||||
|
Quote:
works... Public-key cryptography - Wikipedia, the free encyclopedia You might also want to use "expect" instead... |
|
#5
|
||||
|
||||
|
In a nutshell;
ssh-keygen creates 2 keys, one private, one public (.pub) The public key goes to the server you want to log on to without using a passwd. The private key is the key that stays in the server you connect from and needs to be matched by the pub key. Is there a reason why you want to use 2 commands (sftp, put) instead of one (scp)? |
|
#6
|
|||
|
|||
|
Quote:
|
|||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|