Securing ssh

Posted on 2004-11-11
Medium Priority
Last Modified: 2010-04-22
I administer a system where the only way to login between trusted hosts is via ssh. This is fine apart from it is possible to set up id key files in the user's .ssh directory that get used on a challenge response basis so that if the machines at both ends have the same key files, the user can log in without typing in a password.

Is there anyway to stop this from a system's point of view? I have had a look in /etc/ssh/sshd_config but there doesn't seem to be anything that relates to this precise scenario.

The reason why I want to do this is so that I can share out home directories to a few `semi-trusted' hosts without a user on that system assuming t he identity of another user, getting a hold of their id files and then obtaining access to the other systems as that user. Telnet and rsh/rlogin et al have all been disabled.


Question by:aecooper
  • 2
  • 2
  • 2
  • +4
LVL 36

Expert Comment

ID: 12553647
Hi aecooper,
There are a few lines in the file you mentioned related to this authentication type:-

Have a look in the manual page to find out which one you wish to disable.
LVL 36

Expert Comment

ID: 12553669
RSAAuthentication is for SSH V1 only
PubkeyAuthentication is for SSH V2 only

Therefore I would tyr setting both to no.
LVL 51

Expert Comment

ID: 12557785
and to complete grblades suggestion, disable also:

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

LVL 38

Expert Comment

ID: 12560138

   In sshd_config, you can simply rename
AuthorizedKeysFile     .ssh/authorized_keys  ===> .ssh/xxx

   Then the user can not login without passwd and it safe since sshd_config has permission 600.


Expert Comment

ID: 12567702
Actually, the keys that you are mentioning are a public/private key pair.  They are not the same key.  Every user should have their own, private ".ssh/authorized_keys" file.  I think that the permissions are 600 so other users would not be able to modify it and add their public key.  Since the users' private keys are not your server their should be no problem.  
LVL 23

Accepted Solution

Mysidia earned 2000 total points
ID: 12580112
If you share out home directories like this, I believe that .ssh  directories is just one of many
possible problems... what about .login and .profile files?

Executed when a user logs in..
Programs setuid as the user etc...

I think there are many possible ways this setup would allow one user to execute code as a
different user.

Without major reworking of the shell, login process, and configuration of user programs, the
ability to write to a user's home directory is basically equivalent to the ability to pose as them.

You've managed to make challenge based auth seem a problem, but in general, it's much better than password authentication for remote access purposes
. (Passwords can be guessed, a lot more easily than huge secret keys can be)


Expert Comment

ID: 13736729
The person never chose an answer, I guess this is yet another abandoned post by someone who wanted help, but would not help in return by granting points.

Author Comment

ID: 15597775
No, this is not the case. The first three comments refer to undocumented features not mentioned in the ssh documentation on our system. The last comment was sort of admitting defeat in as much as there is no way of doing what I want and so the only safe thing to do is to disable write access to home directories.

I gave high points to this questions because I wanted a quick solution. But on not finding one I had to do more research into the problem and reluctantly came to the same conclusion.
LVL 23

Expert Comment

ID: 15604275
The options are part of OpenSSH's  sshd_config

PubkeyAuthentication and RSAAuthentication  options
turn on or off those authentication methods.

And   HostbasedAuthentication   controls  .rhosts style authentication

Anyway,   the authorized_keys file could be rendered useless by using
the   'AuthorizedKeysFile'  option in sshd_config on every system, to use
the same file for all users on the machine   (not found in their home directory),
so the SSH problem should be surmountable.

The major problem with a shared directory is user login scripts and preferences
files..  one user might edit another's mail client  config file and include a
command to be run as them, next time they read their mail

In this respect, it would probably be more sound to just create a shared
subdirectory for each user, and place a line in the .login   or .profile to
set HOME to that subdirectory and CD into it.


Author Comment

ID: 15606583
Many thanks for the update... :-) I'll have a look into it. Many thanks once again.

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello EE, Today we will learn how to send all your network traffic through Tor which is useful to get around censorship and being tracked all together to a certain degree. This article assumes you will be using Linux, have a minimal knowledge of …
BIND is the most widely used Name Server. A Name Server is the one that translates a site name to it's IP address. There is a new bug in BIND (https://kb.isc.org/article/AA-01272), affecting all versions of BIND 9 from BIND 9.1.0 (inclusive) thro…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question