Retrieve/download SSH key instead of Send/Upload?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Retrieve/download SSH key instead of Send/Upload?
# 1  
Old 04-04-2015
Retrieve/download SSH key instead of Send/Upload?

Hi,

is it possible to download/retrieve a public SSH key when you are logged in to the remote machine rather than sending the key, for example with ssh-copy-id from your local machine to the remote machine?

I can only ssh into one direction (from the remote machine into the local machine), not the other.

Thanks for any hints.

Best regards,

Gary
# 2  
Old 04-04-2015
Why not, assuming valid permissions. How do you get into the remote machine from local?
# 3  
Old 04-05-2015
I don't. I initiate the ssh only from the remote.

I could use scp, of course. But apart from that I wouldn't know what to do. Is it sufficient when I just create the public_keys directory on the remote machine (doesn't have one yet) and then scp my public key in there? I tried that but it didn't work.

BTW, both machines Mac with Bash.

Thanks!

Gary

Last edited by gczychi; 04-05-2015 at 03:55 AM..
# 4  
Old 04-06-2015
I'd strongly recommend to reread the ssh man page to make sure you know what you are doing:
Quote:
The file ~/.ssh/authorized_keys lists the public keys that are permitted for logging in.
Append your public key to this file - scp alone would not be sufficient. If your key is the first and only one, you'd still need to rename the file after copying it over.
# 5  
Old 04-06-2015
OK, I used the following to copy the public key of my local machine to the remote machine (into which I type the command):
Code:
scp user@domain.com:.ssh/id_rsa.pub ~/.ssh/authorized_keys

After typing my password, it worked. A "cat" revealed the contents of the public key (albeit with the local network name at the end; i.e. the name of the machine in the local network (like user@machine.local); not the external domain name of this machine (user@domain.com)).

However, after quitting and reopening the terminal of the remote computer, I tried to ssh and it didn't work. It is still asking for a password :-(

What could have gone wrong? Am I still missing something? Do I need to restart the whole computer (I can't do that right now, because its a server)?

Thanks a lot!

Gary
# 6  
Old 04-10-2015
Don't restart the whole server. There is nothing in memory that is affecting this.

Consider the permissions of the files in ./ssh on both sides and the permissions of the directory itself too. There are requirements stated in the manual pages and the code checks that the files are not open to easy attack (copy or alter) by other users.

This is the most likely reason for the SSH connection failure.

What output do you get from the command? If there is nothing useful, and a -v flag for more detail. if still nothing, you can add up to three -v flags for even more detail, but it can generate a huge amount of trace very quickly.



Robin
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Solaris 10 - A User Can Download File but Cannot Upload

Dear all, I have made a search on the forum, but couldn't find a related topic about this issue. * I have created a user on Solaris 10 OS with below command and then set password for the user. * Now i can FTP to OS with this user (hattesti). Although i can download files under related... (0 Replies)
Discussion started by: byrusber
0 Replies

2. Solaris

Solaris 8 ssh public key authentication issue - Server refused our key

Hi, I've used the following way to set ssh public key authentication and it is working fine on Solaris 10, RedHat Linux and SuSE Linux servers without any problem. But I got error 'Server refused our key' on Solaris 8 system. Solaris 8 uses SSH2 too. Why? Please help. Thanks. ... (1 Reply)
Discussion started by: aixlover
1 Replies

3. Shell Programming and Scripting

Shell Script for Upload/download files using cURL

hi please help me out here, i want to use curl command in shell script to test web pages, what i have is an opening page, when i click on a button on opening page, the next page comes up and then i have to upload a file n then click another button to submit and then comes the output page,... (2 Replies)
Discussion started by: Olivia
2 Replies

4. Shell Programming and Scripting

Trying to combine upload and download totals from txt file by ip address

I have two files, uploads.txt and downloads.txt. I would like to combine the columns of these files based on the ip address. How can I best do this? Uploads.txt 192.168.0.147 1565369 192.168.0.13 1664855 192.168.0.6 1332868 Downloads.txt 192.168.0.147 9838820 192.168.0.18 12051718... (7 Replies)
Discussion started by: zanyspydude
7 Replies

5. Shell Programming and Scripting

Getting upload and download speeds with the help of script?How?

How can I get the upload and download speed of my pc, provided that my interface is wlan0? I have though something like: #!/bin/sh ups=something downs=somethingelse echo " Your current up speed is $ups Your current down speed is $downs, but I have no idea how to get them?Are... (5 Replies)
Discussion started by: hakermania
5 Replies

6. Shell Programming and Scripting

Using ssh to add register key on ssh server

Hi, I want to use ssh to add a register key on remote ssh server. Since there are space characters in my register key string, it always failed. If there is no space characters in the string, it worked fine. The following is what I have tried. It seems that "ssh" command doesn't care about double... (9 Replies)
Discussion started by: leaftree
9 Replies

7. Linux

restrict file download not upload

hi everybody, How cud i stop downloading files from FTP and allow uploading files in FTP. Thanks & reg, (2 Replies)
Discussion started by: utpalsarkar
2 Replies

8. Shell Programming and Scripting

secure upload using public key

Hi, i was provided with 1. Server IP (Remote) 2. Username and Password (worked when tested basic FTP) 3. Their Public key (GnuPG v1.0.6) They refuse when i upload using basic FTP and insists for encryption. I have Solaris 10 and Linux in my environment. How can i encrypt and upload... (0 Replies)
Discussion started by: prvnrk
0 Replies

9. UNIX for Dummies Questions & Answers

Both HOME and INSERT key send same escape sequence on ssh

I couldn't seem to make 'HOME' key work on my remote windows ssh client to a Fedora Core3 server (the home key works perfectly when i'm physically on site.) To my surprise, using control+V it seems that both my home and insert key send the same escape sequence ^So it must be my windows SSH client... (0 Replies)
Discussion started by: grossgermany
0 Replies

10. Linux

SSH upload error

I am trying to upload a file using SSH . it gives me error "Encounteted 1 errors during the transfer" WHere do I see the error ? why am i getting it ? thanks :) (1 Reply)
Discussion started by: upirate
1 Replies
Login or Register to Ask a Question