|
By Bri Hatch. Summary: How to create passwordless logins to allow remote administration tasks securely with SSH Many of my past newsletters have detailed configuration setups that required you to be able to execute commands on remote machines without interactively supplying a password. The next few articles will help show how you can set up such a system. In general, your passwordless SSH needs fall into three categories:
There are many different ways you may implement passwordless access via SSH.
The first two options are the most general, and quickest to set up. They intentionally do not allow root logins, but have few other useful restrictions. You can get plenty of information about creating this kind of passwordless access by reading the sshd man page, as well as the SSH faq[3] Identity-based authentication, on the other hand, can be very finely controlled. For example you can
It is that last item that can be the most useful. The end goal of this project is to allow a remote account to log into this machine and run only approved commands. Then we'll try a few examples that you may find helpful in the real world. Next week I'll give a quick overview of setting up SSH identities in general, before we delve into our command restrictions. NOTES: [1] There's a lot more that goes on behind the scenes. The ssh process on "bar" must prove it is bar by answering a challenge from foo. Foo needs to have the public portion of bar's ssh host key in order for this to work. [2] Of course, the administrator must allow this form of authentication in the /etc/ssh/sshd_config file. [3] Using hostnames with /etc/ssh/shosts or /etc/rhosts is almost always not what you want -- it lets that remote user log in as any local user. (Except root) [4] http://www.onsight.com/faq/ssh Bri Hatch is Chief Hacker at Onsight, Inc and author of Hacking Linux Exposed and Building Linux VPNs. He's been using SSH to secure his remote logins since Tatu posted the first version of the code - even if the administrators of those machines refused to install it for him. Bri can be reached at bri@hackinglinuxexposed.com. Copyright Bri Hatch, 2002 This is the December 11, 2002 issue of the Linux Security: Tips, Tricks, and Hackery newsletter. If you wish to subscribe, visit http://lists.onsight.com/ or send email to Linux_Security-request@lists.onsight.com.
|