SCP requests password despite common key


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers SCP requests password despite common key
# 1  
Old 07-05-2012
SCP requests password despite common key

I created both a DSA and an RSA key for communication between two SSH servers. Each server has the same DSA and RSA key in their .ssh folders. Yet when copying files from one server to another using a client terminal, I get a password prompt. Why is that? What should I do to bypass the password prompt on each instance of scp?
# 2  
Old 07-05-2012
How did you do that?
# 3  
Old 07-05-2012
Lets say you did the job correctly,
Possible issues:
home directory must be 755!
I lost 2 days to find that...
same directory .ssh must be 700...
# 4  
Old 07-05-2012
Creating the key:
The following command was run on both servers and on the local client in separate terminals.
ssh-keygen -t dsa
I pressed enter three times to create the files .ssh/id_dsa and .ssh/id_dsa.pub. I then performed the following command on both servers.
scp .ssh/id_dsa.pub [user@hostname]:.
I entered my password for the scp command and copied the key from each server onto the other.
cat id_dsa.pub >> .ssh/authorized_keys
This installed the key on the servers.

Next, I copied the key from my local client onto both servers and installed them in the same way. Finally, I performed the following commands for each server on the local client:
scp [user@hostname]:.ssh/id_dsa.pub . ; cat id_dsa.pub >> authorized_keys
All machines are authorized to view and copy files on one another. The local client is able to share files between both servers with no password input. One server is able to copy files from the other with no password input. However, the second server is unable to copy files from the first without password input. And when I do enter the password, it breaks the operation.

EDIT: I'm a complete newbie. What do you mean by "must be 755" or "must be 700"?
# 5  
Old 07-05-2012
File permission:
Code:
ant:/home/vbe $ ls -ld .
drwxr-xr-x  55 vbe        bin          30720 Jun 25 15:33 .
ant:/home/vbe $ ls -ld .ssh
drwx------   2 vbe        bin           1024 Jun 15 16:47 .ssh

# 6  
Old 07-05-2012
Pretend your login directory is: /home/snorton

Then
Code:
chmod 755 /home/snorton
cd /home/snorton
chmod 700 .ssh

This sets the file permissions on your home directory to 755 and the .ssh directory to 700.
# 7  
Old 07-05-2012
If you got the idea, I wonder still if you did not overwrite one...
Start all again, but this time lets say you have local, server1 server2...
once keys are generated, copy your local fresh one for safety:
Code:
cp -p id_dsa.pub id_dsa.pub.mylocal

do the same for the others replacing local by server1 etc...
scp id_dsa.pub.mylocal to the other servers
Do the same on the other servers
Now you will have three (distinct) files to append to a freshly created authorized_keys...

--- ADDENDUM ---

Since Im not convinced Im very clear, have a look also here:
https://www.unix.com/emergency-unix-l...t-color-5.html
at post #30 of bakunin

Last edited by vbe; 07-05-2012 at 11:20 AM.. Reason: addendum
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Linux - Join 2 csv files with common key

Hi, I am trying to join 2 csv files, to create a 3rd output file with the joined data. Below is an example of my Input Data: Input File 1 NAME, FAV_FOOD, FAV_DRINK, ID, GENDER Bob, Fish, Coke, 1, M Lisa, Rice, Water, 2, F Jenny, Noodle, Tea, 3, F Ken, Pizza, Coffee, 4, M Lisa,... (7 Replies)
Discussion started by: RichZR
7 Replies

2. UNIX for Dummies Questions & Answers

Merge selective columns from files based on common key

Hi, I am trying to selectively merge two files based on keys reported in the 1st column. File1: #file1-header1 file1-header2 111 qwe rtz uio 198 asd fgh jkl 165 yxc 789 poi uzt rew 89 lkj File2: #file2-header2 file2-header2 165 ghz nko2 ... (2 Replies)
Discussion started by: dovah
2 Replies

3. UNIX for Advanced & Expert Users

scp without first time key generation and confirmation

Hi All, I have setup ssh keys for a user to transfer files without password between two hosts. But still the first time scp asks for confirmation and generates a key Due to this our jobs are failing. Is there a way I can avoid that first time key generation and confirmation also and automate... (3 Replies)
Discussion started by: baanprog
3 Replies

4. UNIX for Dummies Questions & Answers

Public and Private Key generation for scp

Hi, What tool is used to generate public and private keys for SCP? Do you have an example script that generates these keys, puts them in files and then another example script that references them from SCP? Thanks, (9 Replies)
Discussion started by: Astrocloud
9 Replies

5. Shell Programming and Scripting

Merge multiple lines in same file with common key using awk

I've been a Unix admin for nearly 30 years and never learned AWK. I've seen several similar posts here, but haven't been able to adapt the answers to my situation. AWK is so damn cryptic! ;) I have a single file with ~900 lines (CSV list). Each line starts with an ID, but with different stuff... (6 Replies)
Discussion started by: protosd
6 Replies

6. Shell Programming and Scripting

SCP command end with Host Key not found in database

Hi, I'm trying to copy a file from one server to remote server using SCP command. Below is the command i tried and got host key not found in database errror. scp sendfile.txt Remoteserver:/home/xxxx/. Error Message: Host key not found from database Key fingerprint:... (2 Replies)
Discussion started by: skcvasanth
2 Replies

7. Shell Programming and Scripting

Help- Change the password of users to common one

Hi all I have some 106 users of which i need to change the password of them to a common one. I dont know their paswword. But i need to reset them to a common one. How can i do this with a shell script? It would be a great help if some one can help to sort out this.:b::b: I know it can be... (0 Replies)
Discussion started by: Tuxidow
0 Replies

8. UNIX for Dummies Questions & Answers

SCP using a dsa key

Hello all, My first post in this forum. I am trying to download a file from a server to which I have been granted access. They setup a DSA public key and I have a local private key. When i try to download the file it prompts me for my password. How can I tell unix to use the DSA key... (1 Reply)
Discussion started by: who2
1 Replies

9. UNIX for Advanced & Expert Users

Setting Up public key on Windows for ssh/scp

Hi, I am trying to scp a file from our Unix server to the local Windows machine.I have created the key pair in Unix server using ssh-keygen command in unix. But I am not sure where can we put the public key(generated on Unix) in Windows machine so that scp from Unix machine to Windows is... (3 Replies)
Discussion started by: dennis.jacob
3 Replies
Login or Register to Ask a Question