LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-13-2013, 04:39 PM   #1
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 447

Rep: Reputation: 28
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...
 
Old 11-13-2013, 04:55 PM   #2
sag47
Senior Member
 
Registered: Sep 2009
Location: Orange County, CA
Distribution: Kubuntu x64, Raspbian, CentOS
Posts: 1,831
Blog Entries: 36

Rep: Reputation: 451Reputation: 451Reputation: 451Reputation: 451Reputation: 451
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.
 
Old 11-13-2013, 05:48 PM   #3
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 447

Original Poster
Rep: Reputation: 28
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
 
Old 11-13-2013, 05:50 PM   #4
sag47
Senior Member
 
Registered: Sep 2009
Location: Orange County, CA
Distribution: Kubuntu x64, Raspbian, CentOS
Posts: 1,831
Blog Entries: 36

Rep: Reputation: 451Reputation: 451Reputation: 451Reputation: 451Reputation: 451
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.
 
Old 11-13-2013, 05:57 PM   #5
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 447

Original Poster
Rep: Reputation: 28
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...
 
Old 11-13-2013, 10:12 PM   #6
sag47
Senior Member
 
Registered: Sep 2009
Location: Orange County, CA
Distribution: Kubuntu x64, Raspbian, CentOS
Posts: 1,831
Blog Entries: 36

Rep: Reputation: 451Reputation: 451Reputation: 451Reputation: 451Reputation: 451
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.
 
Old 11-14-2013, 02:59 AM   #7
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 447

Original Poster
Rep: Reputation: 28
Ok sag i will ...was a bit lazy...i admit lol...really thanks for your help
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting up ssh access with keys with Putty keymoo Linux - Security 3 09-30-2013 09:20 PM
SSH host keys VS SSH keys kenneho Linux - Security 3 09-11-2008 07:03 AM
Help setting up SSH keys Atif Khan Linux - Newbie 2 07-10-2008 06:37 AM
Changing server password AFTER setting ssh-auto keys Swakoo Linux - General 1 02-22-2006 05:38 AM
Configuring SSH to accept only keys (already have keys) fr0st Linux - Security 3 11-04-2003 04:31 AM


All times are GMT -5. The time now is 06:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration