User Tools

Site Tools


system:ssh:security

This is an old revision of the document!


# Live log: ``` watch -n 1 tail -n 50 /var/log/auth.log ```

# Locking down SSH Server

## Whitelist and Blacklist IP addresses Stop SSH service first!

``` sudo systemctl disable ssh.service # and sudo systemctl stop ssh.service ```

to start: ``` sudo systemctl enable ssh.service # and sudo systemctl start ssh.service ```

Check for password attempts: ``` # grep “Failed password” /var/log/auth.log ``` and ``` cat /var/log/auth.log ```

###Restrict IP address (whitelist): ``` sudo nano /etc/hosts.allow ``` and add the following lines to allow the whitelisted IP blocks to your public SSH. ``` sshd: 192.168.x.x/32, … ```

###(Blacklist): ``` sudo nano /etc/hosts.deny ``` and add the following lines to deny all SSH connections to your public SSH port

``` sshd: ALL ```

## Whitelist user names for login ``` sudo nano /etc/ssh/sshd_config ``` and add: ``` AllowUsers userName ```

system/ssh/security.1595795769.txt.gz · Last modified: by ltsover9000