Quantcast
Viewing all articles
Browse latest Browse all 4928

Advanced users • Re: ssh known_hosts format and cleaning up

If you have temporary systems (for testing purposes), you can tell ssh to use a dummy known_hosts file with 'ssh -o UserKnownHostsFile=/dev/null user@host'.

I reserve the 'raspberrypi' hostname for whatever my current test system is, and have an entry in my ~/.ssh/config file so I don't have to worry about known hosts or the usual warnings

Code:

Host raspberrypi    User pitest    UserKnownHostsFile /dev/null    StrictHostKeyChecking no    LogLevel ERROR
The config setting 'HashKnownHosts no' precludes ssh from hashing the known host entries, and can also be useful depending on what you're trying to achieve. I use a combination of rpdom's sample above and other settings to customize ssh operation.

It's also worth noting that if your .ssh/config file has multiple 'Host' stanzas, you can use a 'Host *' stanza at the end of the config to default things not supplied by prior stanzas.

For instance:

Code:

# This .ssh/config is used by all my hosts, both internal and external# One special host that this configures me for external SSH accessHost pvc     Hostname myhost.mydomain.com     User bls     Port 44444     StrictHostKeyChecking yes     UserKnownHostsFile ~/.ssh/known_hosts# Server hosts that I want StrictHostKeyChecking enabledHost gw pisrv1 pvn mondo win10scan skypi     StrictHostKeyChecking yes     UserKnownHostsFile ~/.ssh/known_hosts# DefaultsHost *     StrictHostKeyChecking no     UpdateHostKeys no     UserKnownHostsFile /dev/null     LogLevel quiet     # HashKnownHosts no keeps known_hosts file understandable, but less secure     HashKnownHosts no     ForwardAgent no     ForwardX11 no     XAuthLocation /usr/bin/xauth

Statistics: Posted by bls — Thu Aug 29, 2024 5:31 pm



Viewing all articles
Browse latest Browse all 4928

Trending Articles