LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Setting up SSH keys... (https://www.linuxquestions.org/questions/linux-newbie-8/setting-up-ssh-keys-4175484483/)

sigint-ninja 11-13-2013 03:39 PM

Setting up SSH keys...
 
ok so i want to setup a ssh tunnel between 2 or three computers.

i know there is a public key...on the computer you want to access...and you need a private key to correspond with the public key right?

i read that this command:

The first step is to create the key pair on the client machine (there is a good chance that this will just be your computer):
ssh-keygen -t rsa

so i entered this command on the computer i want to send data from...it told me that the public key has been saved in home/me/.ssh/id_rsa.pub ...do i have to copy this file to the "server" ...but where is my private key then to correspond with the public key...sorry this is a little confusing to me...

any help appreciated...

sag47 11-13-2013 03:55 PM

There's a helpful utility, ssh-copy-id, which will add your public key to the authorized_keys file on the server you wish to connect to. Be aware of special permissions on the SSH files as it's a common mistake made by people new to configuring SSH. Keep your private key on the client.

sigint-ninja 11-13-2013 04:48 PM

ok my man thats beautiful!!! so i used the utility and it added the key to the server and im able to just go
user@ipaddress and its auto connecting without a password to the remote shell

thanks a mill!!! last question...how could i add another private key to a different machine to connect to the same server?

thanks again
SN

sag47 11-13-2013 04:50 PM

You can use that same command on the other machine. While not required it's recommended to have separate keys for the two machines. If you need to manually add it because ssh-copy-id is not available (i.e. you're using Windows or some other platform) then you'll need to manually add the public key to the authorized_keys file. See the man page.

sigint-ninja 11-13-2013 04:57 PM

ok so the machine thats working is a windows 2008 server using cygwin64. the "server" is a centos machine...i want to add ssh key to my debian box...but i dont think it will work from the windows server like it did to the centos box as i dont have port 22 open on my home network (ISP has problem with port forwarding, cant get it working) can i manually add it? do i copy data from the windows server file? is it a key i need to add...sorry for all the questions...you been great...

sag47 11-13-2013 09:12 PM

http://shapeshed.com/using_shared_ke...h_on_centos_5/

That tutorial should be all you need. You need to google around and do your own research. This topic has been covered thousands, even millions, of times. I googled "openssh shared key tutorial" and found that for you. You need the public key to be in authorized_keys and the private key to be on the client. I'm not sure how to explain it more forward.

sigint-ninja 11-14-2013 01:59 AM

Ok sag i will ...was a bit lazy...i admit lol...really thanks for your help


All times are GMT -5. The time now is 03:21 AM.