Back to Securing a Machine

Exposed services are often compromised through weak logins, default accounts, guest access, or overly broad administrative permissions. This page focuses on who can authenticate and what they can reach or change after authenticating.

SSH

Configuration file:

/etc/ssh/sshd_config

Common issues:

Fixes:

PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
PermitEmptyPasswords no
MaxAuthTries 3
LoginGraceTime 30
AllowUsers adminuser

If password authentication must remain enabled, add brute-force protection such as fail2ban:

sudo apt install fail2ban
sudo systemctl enable fail2ban
sudo systemctl start fail2ban

Restart SSH:

sudo systemctl restart ssh

Databases

MySQL / MariaDB

Default or anonymous database accounts are a common foothold.

Run:

sudo mysql_secure_installation

This removes anonymous users, disables remote root login, removes the test database, and tightens authentication defaults.

Microsoft SQL Server

If the database only serves a local application, remote connections may be unnecessarily broad.

Fix in SQL Server Management Studio:

  1. Connect to the server.
  2. Right-click the server and open Properties.
  3. Select Connections.
  4. Disable Allow remote connections if it is not required.

Restart the SQL Server service after changes.

File Sharing Services

Samba

Configuration file:

/etc/samba/smb.conf

Common issues:

Fixes:

guest ok = no
read only = yes

Restart Samba:

sudo systemctl restart smbd

NFS

Configuration file:

/etc/exports

Common issue:

Fix:

/shared 192.168.1.10(rw,sync,root_squash)

Restart NFS:

sudo systemctl restart nfs-server

Windows SMB

Check shares:

Get-SmbShare

Fixes:

Mail Systems

Postfix

Configuration file:

/etc/postfix/main.cf

Common issue:

Fix:

smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination

Restart Postfix:

sudo systemctl restart postfix

Microsoft Exchange

Common issues:

Fixes:

Quick Review Checklist

When reviewing authentication and access control, check for:

Back to Securing a Machine