User Tools

Site Tools


eduardo:linux:ssh

Table of Contents

SSH

Here are a couple of best practice for editing the /etc/ssh/sshd_config

Root login

It is common best practice to disable root login via ssh. Login as standard user and sudo to root instead.

PermitRootLogin no

DNS

Ever tried logging into a machine with ssh and found you have to wait much longer than reasonable for the session to start? Especially annoying with machines on local network (or a VM attached to a virtual network) that should be letting me in immediately.

Basically the session is slow to start because the SSH server is trying to lookup the hostname of the SSH client and for whatever reason it's timing out (e.g., it can't reach a nameserver, because you happen to be offline)

UseDNS no
! *** Not sure if the below line is needed
GSSAPIAuthentication no

It's often nice to include a banner at login

Banner /etc/ssh/banner

An example banner below

|@@@@@@@@@@@@@@@@@@\/===============================================\
|@@@@@           @@|                                                 |
|@@@@           @@@| Telstra GCC Mgmt SFTP server - tlghcbshkg1      |
|@@@@@@@@@@@@@@@@@@|                                                 |
|@@@\\\\@@@@\@@@@@@| Unauthorised access is strictly prohibited      |
|@\\\\\@@@@\\\\@@@@|                                                 |
|@\\\\@@@@\\\\\\@@@| Disconnect IMMEDIATELY if you are not an        |
|@@\\@@@@\\\\\\\@@@|                                                 |
|@@@\\\\\\\\\\\@@@@| authorized user!                                |
|@@@@@@@\\\\@@@@@@@|                                                 |
|@@@@@@@@@@@@@@@@@@/\===============================================/
eduardo/linux/ssh.txt · Last modified: 2024/02/23 08:20 by 127.0.0.1