LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 10-23-2013, 07:57 PM   #1
nerdofdarkness
LQ Newbie
 
Registered: Oct 2013
Posts: 28
Blog Entries: 1

Rep: Reputation: Disabled
key files and origin locations for passwordless ssh


Suppose I have a user "joe" who only exists on one machine, localhost. I want "joe" to be able to ssh onto localhost without a password. I can set up passwordless ssh because /home/joe/.ssh has a bunch of files that serve as keys. So when joe is logged into localhost, he has access to that directory and those keys, and he can ssh to localhost.

But "joe" is a common name. Suppose localhost is open to the Internet. I suppose anyone on the Internet could try to open up an ssh connection to localhost with the username 'joe.' In that event, the outsider wouldn't have access to the keys in /home/joe/.ssh, but the sshd process would probably be able to read those keys. Would ssh allow the outsider to log in as joe?

Thanks.
 
Old 10-23-2013, 08:08 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

you need to understand that these keys come in pairs: the private key and corresponding public key. The outsider joe would need to be in possession of the private key corresponding to the public key listed in /home/joe/.ssh/authorized_keys file.

Evo2.
 
1 members found this post helpful.
Old 10-25-2013, 02:25 AM   #3
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,308
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
You can be sure that noone can get in without a key by setting "PasswordAuthentication" to "no" in /etc/ssh/sshd_config. That will make possession of a valid key a prerequisite for getting in. Just be sure you have your own keys working before making that change. It's getting to be recommended practice for any Internet-facing machine these days.
 
1 members found this post helpful.
Old 10-29-2013, 07:33 PM   #4
nerdofdarkness
LQ Newbie
 
Registered: Oct 2013
Posts: 28

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by evo2 View Post
Hi,

you need to understand that these keys come in pairs: the private key and corresponding public key. The outsider joe would need to be in possession of the private key corresponding to the public key listed in /home/joe/.ssh/authorized_keys file.

Evo2.
That's very cool and very interesting, but I've been looking at the basics of this public-key stuff for several days and the grand sum total of my discoveries is that public key crypto is really hard!

Edit: I mean, it's easy to unpack a utility and get it running, but my head starts to spin when I read the "basic" introductions to how this software works.

Wow.

I'm not giving up on learning about this stuff, but I have revised my plans for learning all about it in a few days. It's going to take some time and practice.

Thanks for the info.

---------- Post added 10-30-13 at 08:34 AM ----------

Quote:
Originally Posted by Turbocapitalist View Post
You can be sure that noone can get in without a key by setting "PasswordAuthentication" to "no" in /etc/ssh/sshd_config. That will make possession of a valid key a prerequisite for getting in. Just be sure you have your own keys working before making that change. It's getting to be recommended practice for any Internet-facing machine these days.
That's a great suggestion. I just modified that as suggested. It's the first step on a long road to learning more. Thanks.

Last edited by nerdofdarkness; 10-29-2013 at 07:35 PM.
 
Old 11-01-2013, 06:19 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Re Public/Private keys; think of them as 2 halves of the same (composite) key if it helps.
Basically you need both halves, one at each end, to connect/login.
Also, each 'pair' is unique.
 
Old 11-01-2013, 06:49 AM   #6
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
Quote:
Originally Posted by nerdofdarkness View Post
It's the first step on a long road to learning more. Thanks.
Even with an SSH-key I always use a passphrase and an SSH-agent. I really like the explanations on this webpage: ssh-agent-forwarding.
 
  


Reply



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
Rsync password asked even after generating key (while ssh works passwordless) frsechet Linux - Server 46 02-06-2015 05:55 PM
Passwordless ssh works. Normal login/ssh Fails. gurunarayanan Linux - Newbie 9 11-08-2012 04:42 AM
SSH with passwordless public/private key not working on another account on server infocom Linux - Server 14 12-27-2010 05:09 AM
Syntax of SSH public and private key files Meson Linux - Security 4 05-11-2008 08:19 AM
Passwordless SSH with SSH commercial server and open ssh cereal83 Linux - General 7 04-18-2006 12:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 04:32 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