LinuxQuestions.org
Help answer threads with 0 replies.
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 04-22-2018, 07:39 AM   #1
chickenjoy
Member
 
Registered: Apr 2007
Distribution: centos,rhel, solaris
Posts: 239

Rep: Reputation: 30
Confused on ssh key pairs


I have tested the following:
  1. user1@server1 - generate priv and pub keys
  2. i copy the pub key to user2@server2
  3. i can now login as user2@server2 with the need for a password.
  4. i did the opposite and the same logic applied.

What if i want to setup an SFTP server and i created a priv and pub key with user1@server1. and i want give give someone sftp access to user1 by using a key pair and not a password. I cannot request server2's public key and import it in mine; i want to give them a key that he can use to authenticate to server1. how can i achieve this?
 
Old 04-22-2018, 07:55 AM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,718
Blog Entries: 4

Rep: Reputation: 3959Reputation: 3959Reputation: 3959Reputation: 3959Reputation: 3959Reputation: 3959Reputation: 3959Reputation: 3959Reputation: 3959Reputation: 3959Reputation: 3959
Each user+client+server tuple should have its own key pair.

Check "man ssh-keygen" for the -f and -C options. The -f allows you to give the files useful names and the -C allows you to put useful comments inside the key. That way you or they can have more than one key pair kicking around.

They can generate the key pair themselves:

Code:
cd ~/.ssh/
ssh-keygen -f server2_ed25519_key -t ed25519 -C "Oh this key is for somebody"
Be sure they enter a good passphrase for the key.

Then they can send you the file ~/.ssh/server2_ed25519_key.pub via e-mail or USB stick and you can install it in the user1 account at server1. The public key is public so you don't have to worry that much about keeping it hidden and e-mail is fine. The private key is a different matter and they should keep it very safe on their system.
 
1 members found this post helpful.
Old 04-22-2018, 08:50 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,644

Rep: Reputation: 6280Reputation: 6280Reputation: 6280Reputation: 6280Reputation: 6280Reputation: 6280Reputation: 6280Reputation: 6280Reputation: 6280Reputation: 6280Reputation: 6280
In addition you can have multiple public keys in the same users authorized_keys file.
 
1 members found this post helpful.
  


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
Understanding SSH and Key Pairs azurepancake Linux - Software 2 05-21-2015 02:59 PM
login using key pairs seabro Linux - Newbie 3 09-20-2014 01:30 AM
ssh best practice: key pairs per user or OS? Other considerations? mrtwice Linux - Security 2 04-20-2010 09:41 PM
Public/Private Key Pairs Kissell Linux - Security 3 01-24-2009 04:36 AM
Big Brother? Key Pairs? cwizardone Slackware 1 02-27-2007 06:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:57 PM.

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
Open Source Consulting | Domain Registration