Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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...
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.
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?
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.
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...
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.