scp scripting without asking password


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting scp scripting without asking password
# 1  
Old 02-10-2006
Data scp scripting without asking password

I like to copy a file from one server server1 from path path1 to another server server2 to path path2.

User logging in both the servers are same say user1

I tried to use ssh to generate public/private key pairs and then copy without prompting for password.

These are the steps i followed

1. Public/private key pairs (identity/identity.pub) are generated in home/user1/.ssh in server1. using the following command
ssh-keygen -t rsa

2. identity.pub in server 1 is copied to home/user1/.ssh/authorized_keys in server 2.
scp .ssh/id_rsa.pub user1@server1:/home/user1/.ssh/authorization_keys/
(this scp is done by providing the password. i double checked this copy and i can confirm this copy done properly)

3. Tried the following command in server1
scp path1/file1 user1@server2:/path2/file2

I believe it should not ask for the password and copy should happen smoothly. But it is still prompting for password. Why is it still asking for password?

And also note that permissions for .ssh directory in both servers are set to 600. Let me know where i went wrong.

Please help me in this issue. I am breaking my head for one day for this. Smilie

Last edited by jwala; 02-10-2006 at 07:42 PM..
# 2  
Old 02-10-2006
Set the permissions for the .ssh directories to 700, not 600. 600 would prevent the owner of the directory from accessing it. Set the perms on the authorize_keys/authorized_keys2 file to 600.

I think that should do it.
# 3  
Old 02-12-2006
I set the permission for .ssh directory to 700 and .ssh/authorized_keys to 600. Still it is not working. I couldnt understand where i went wrong. I retried everything again. Still not working. Please help me
# 4  
Old 02-13-2006
Quote:
Originally Posted by jwala
user1@server1:/home/user1/.ssh/authorization_keys/
Did you really copy to a file named authorization_keys? It should be authorized_keys
# 5  
Old 02-14-2006
One more thing - if you are using SSH protocol version 2, the file is authorized_keys2 and not authorized_keys. Just check that out, will you?
# 6  
Old 04-14-2009
Thank you blowtorch, dangral very much .. i had a similar issue and i got it resolved by following your steps... thanks alot...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

scp without password

Hello experts, OS : CentOS Could you please help me with the following scenario : I wish to use scp command in order to copy a file (say : f1.txt) from server 2 to server 1. Both servers have a common user (say : user1) configured. Also, the file is owned by the same user on both... (2 Replies)
Discussion started by: H squared
2 Replies

2. Shell Programming and Scripting

scp without password between two servers

Hello Folks, I have two linux server accounts server1 and server2 From the terminal if I say this command, scp /source/folder/from/server1/unix.txt user@server2.com:/destination/folder/ Then it prompts for the password user@server2.com's password: I enter my password and then it... (1 Reply)
Discussion started by: jacobs.smith
1 Replies

3. Shell Programming and Scripting

SFTP / SCP using password

Hi, I was provided with sftp servername, user and password and the requirement is to connect to sftp server using credentials provided and drop the file. Manually i am able to connect with commands like sftp user@servername and after clicking enter, i was asked for a password and entering... (4 Replies)
Discussion started by: forums123456
4 Replies

4. Shell Programming and Scripting

Script should wait for password while doing scp

Hi team, need help on this :- trying to scp a file from A ( it could any server among hundreds not one) server to B server ( fixed ) . The script runs in a third server CFGEngine server. a. we dont use static password ( its pin + rsa token) so , "here documents" kind of thing is not... (3 Replies)
Discussion started by: gauravsharma29
3 Replies

5. Linux

Regarding scp with out password

Dear all, I have two servers A and B. I want to do scp with out password between these two servers. I created ssh-keygen and copied the id-rsa.pub file to each of them in authorized_keys. But I could login only from B to A with out password. From A to B it is asking for a password. ... (5 Replies)
Discussion started by: jegaraman
5 Replies

6. UNIX for Advanced & Expert Users

scp without prompting for password

I am trying to copy a file from remote machine using scp. I followed the steps to configure public/private key usage. But still prompting for password when I do ssh. I did the following steps to configure scp without asking password Step 1 : local host > ssh-keygen -t rsa and when prompted... (9 Replies)
Discussion started by: satish@123
9 Replies

7. Red Hat

sftp/scp without password

Hi, I want to use sftp/scp without password.How can I do that ?? I plan to use script with scp/sftp and execute by cronjob ,any sample or example?? How can I test the scp/sftp working or not in the same user account , in the same red linux server?? any suggestion ??? (5 Replies)
Discussion started by: chuikingman
5 Replies

8. UNIX for Dummies Questions & Answers

scp without password - NT to UNIX

Hi guys, I wasn't sure which thread to include this one in (unix or shell scripting) but chose here based on search results. I need to automate a process which requires the need to transfer a file from a machine running on NT to the database server on UNIX. I've found this and a number of other... (7 Replies)
Discussion started by: Dird
7 Replies

9. Shell Programming and Scripting

scp file to another server without asking for password

hi I tried reading some of the threads w.r.t scp/sftp file to another server in the same network without asking for password while copying files.....but couldnot succeed. i have generated the public key for the system using "ssh-keygen -t " and kept it in the .ssh/authorized_keys file. ... (8 Replies)
Discussion started by: aemunathan
8 Replies

10. UNIX for Advanced & Expert Users

scp without password

Hi, when I use scp test.jsp user@remote:/tmp/ I'm prompted user@remote's password: How can I avoid it ? Thank you. (8 Replies)
Discussion started by: big123456
8 Replies
Login or Register to Ask a Question