scp without password between two servers


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting scp without password between two servers
# 1  
Old 11-08-2012
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,

Code:
scp /source/folder/from/server1/unix.txt user@server2.com:/destination/folder/

Then it prompts for the password

Code:
user@server2.com's password:

I enter my password and then it starts copying.

But, I would like to do this using bash script because of the size of the files. I searched online before posting and came across using
Code:
ssh-keygen

. This one will not serve the purpose because I don't have admin rights to copy the .pub files on to other servers.

Any pointers on how to pass the password to a bash script that can be submitted to the server for execution will be greatly appreciated.
# 2  
Old 11-08-2012
Why do you need admin rights to copy the .pub file? You can scp the .pub file to other server & append it to .ssh/authorized_keys using password for this first time.

Last edited by Yoda; 11-08-2012 at 05:30 PM..
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

Automate scp between servers

Hello, Could someone please help me with the below requirement? I need to automate scp files between two servers. I have a file having server names and paths to the folder like below server1 /path/to/folder/ server1 /path/to/folder/ server1 /path/to/folder/ server2 /path/to/folder/... (4 Replies)
Discussion started by: Kochappa
4 Replies

3. 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

4. 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

5. 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

6. Shell Programming and Scripting

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 ... (5 Replies)
Discussion started by: jwala
5 Replies

7. Shell Programming and Scripting

Script to SCP a file to multiple servers

Hi All, I am a total noob to the Unix world, and i hope to learn a lot from this wonderful community. Here's my first post and question , i am trying to SCP a file to multiple servers (multiple destinations) through this little script : #!/bin/ksh # copy files # File to be copied... (7 Replies)
Discussion started by: rdlover
7 Replies

8. Shell Programming and Scripting

Scp between two servers

Is there a way to connect betwwen two servers A and B without using prompting for a password ..... I am writing a script which includes picking up files from and puts them to B. using mget .. To make the script fully automable I am looking for a passwordless authentication... Any... (2 Replies)
Discussion started by: ultimatix
2 Replies

9. UNIX for Dummies Questions & Answers

Unable to scp/sftp between two servers

I have four servers that for all intents and purposes are the same (I have the same profile on all four), North, South, Brooklyn & Queens. I have a script that scp's a file from Queens to brooklyn, and it runs just fine. I tried to replicate the script on South, to transfer a file to North, and... (1 Reply)
Discussion started by: DeCoTwc
1 Replies

10. Shell Programming and Scripting

scp between 2 servers - invoked at 3rd server

I have a couple of servers that can't see each other and need to copy files from one to the other. I try to invoke scp from a 3rd server that can see both servers - get error msgs that are cryptic. from server C I can do scp user@serverA:~/file . scp file user@serverB:~ but if I try to... (2 Replies)
Discussion started by: bigjohn-nj
2 Replies
Login or Register to Ask a Question