Skip to content

Instantly share code, notes, and snippets.

@mehdishahdoost
Created July 8, 2023 21:14
Show Gist options
  • Save mehdishahdoost/10c1e2fdaf6369e44790a236aea88d3a to your computer and use it in GitHub Desktop.
Save mehdishahdoost/10c1e2fdaf6369e44790a236aea88d3a to your computer and use it in GitHub Desktop.
Secure Ubuntu server

Create user with sudo access

sudo adduser <username>
sudo usermod -aG sudo <username>
su — <username>

Change sshd configs

vim /etc/ssh/sshd_config

PermitRootLogin no
PasswordAuthentication no
ClientAliveInterval 300
ClientAliveCountMax 0
port 2326
X11Forwarding no

restart service

sudo service sshd restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment