• Home
  • WordPress
  • web Hosting
    • Free hosting
    • Cheap Hosting
    • comparison cloud , vps, shared, wordpress
    • managed wordpress hosting
    • managed cloud hosting
  • page Speed
  • Deals
  • Services
  • About

RAaz Kumar .com

wordpress tutorials seo hosting etc


change ssh port in linux – avoid sshd ddos attacks

change ssh port in linux in following steps, are you getting lot of bot flood traffic, high cpu usage due to default ssh port 22 in linux, then change the ssh port in linux and get sae server costs, and scale your linux server by simply changing the linux ssh port.

 

with default port 22

sshd Invalid user from port  33378

 

first allow New Port in linux firewall & cloud provide firewall

ex: my case added digitalocean firewall.

 

Check well known ports choose from (1024 to 65535)

ssh brute force
sshd Invalid user from port
source port was 4627, the destination port was 2221
sshd blocked login by disconnecting the tcp connection
port number given in the log is the port on the client side, not on yours.
change SSHD port 21 to other
firewall rule block or drop
allow new port after successful login block old port 22.
choose any port between  1024 to 65535
 

add new SSH port to linux firewall allow list

 
sudo ufw allow 20482/tcp
sudo ufw allow ssh
 
sudo ufw app list
Available applications:
  Apache
  Apache Full
  Apache Secure
  OpenSSH
 

edit openssh  in ubuntu debian linux distro

you can use nano or vim command.
nano /etc/ssh/sshd_config
CTRL+X to exit and save changes

Change default ssh port 22 to new port

#Port 22
Port 20682
default values are commented, if you uncomment new port it will override existing one.

#2 change ssh port in linux – restart sshd or ssh server – #

ssh for centos fedora redhat linux distributions.
sshd for ubuntu and debian both works fine.
service sshd reload
service sshd restart
systemctl restart ssh

Check SSH server listening newport or not

# netstat -tlpn| grep ssh
tcp 0 0 0.0.0.0:20682 0.0.0.0:* LISTEN 3529/sshd
tcp 0 0 0.0.0.0:1022 0.0.0.0:* LISTEN 1628/sshd
nano /etc/ufw/applications.d/ssh-server
remove port 22 from there.
22 port also listening

Login with New Port  – change ssh port in linux

How do I unblock port 22?
ufw allow 22

Block Port 22 Using UFW Firewall – change ssh port in linux

sudo ufw deny 22
root@-s-4vcpu-8gb-blr1-01:~# sudo ufw deny 22
WARN: Skipping ‘openssh-server‘: couldn’t process

Block Port 22 using  digitalocean firewall

go to networking >> firewall
Inbound Rules
Set the Firewall rules for incoming traffic. Only the specified ports will accept inbound connections. All other traffic will be blocked.
checkout digitalocean firewall
also know about digital ocean free credit

Check linux auth  syslogs get rid of ddos attacks

tail -f /var/log/auth.log

Apr 24 06:26:44 -s-4vcpu-8gb-blr1-01 sudo: root : TTY=pts/0 ; PWD=/root ; US ER=root ; COMMAND=/usr/sbin/ufw deny 22

Failed password for invalid user dong from 170.245.200.100 port 54354 ssh2
Apr 18 06:27:44 -s-4vcpu-8gb-blr1-01 sshd[19631]: Received disconnect from 170.245.200.100 port 54354:11: Bye Bye [preauth]
Apr 18 06:27:44 -s-4vcpu-8gb-blr1-01 sshd[19631]: Disconnected from invalid user dong 170.245.200.100 port 54354 [preauth]
Apr 18 06:27:58 -s-4vcpu-8gb-blr1-01 sshd[19633]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=80.169.112.191 user=root
Apr 18 06:28:00 -s-4vcpu-8gb-blr1-01 sshd[19633]: Failed password for root from 80.169.112.191 port 33064 ssh2
Apr 18 06:28:01 -s-4vcpu-8gb-blr1-01 sshd[19633]: Received disconnect from 80.169.112.191 port 33064:11: Bye Bye [preauth]
Apr 18 06:28:01 -s-4vcpu-8gb-blr1-01 sshd[19633]: Disconnected from authenticating user root 80.169.112.191 port 33064 [preauth]

//disable root login, password login, pamuse=no.

Summary on changing ssh linux port

Hope, you get clear understanding of  change of ssh port in linux, and the effects of changing linux ssh ports get rid bot traffic and strengthening linux server security you also want know about hardening linux security by tweaking sysctl. conf

Related topics:

  1. ufw firewall commads allow port enable disable ubuntu 20.04
  2. ddos attack prevention
  3. Ip tables / ufw / firewall d commands for block port ip rate limiting
  4. how to uninstall package in linux ubuntu rpm, yum apt-get
  5. check linux version (lsb_release -a) ubuntu debian 32 or 64 bit

tutorials

  • Vivek Bindra Videos Transcription (business strategy)
  • git commands
  • new relic php agent install in 3 steps
  • new relic mysql install integration - 2 ways fix problems
  • new relic installation linux (infrastructure agent , php, mysql , nginx)
  • xampp tutorials 2021 installation errors fix wordpress phpmyadmin mysql apache
  • Redis performance metrics & tuning for nginx apache ubuntu & debian
  • Devops course Syllabus topics PDF AWS, Azure, cisco, redhat
  • CCNA Syllabus pdf (CCNA / CCNP vs devops vs mcsa /MCSE)
  • how to create a website free of cost on google
  • what is vpn vs proxy vs tor, http vs https, http2, tcp vs udp, kali linux sql source code injection
  • nginx server tutorials (installation, configuration, performance tuning, security)
  • MySQL Tutorial (create,connect database, update tables, export etc) Documentation & TIPS
  • AUdio Editing Background Noise removal (Audacity, Adobe Premiere Addition, Camtasia Filmora Windows Obs)
  • Android Studio tutorials syllabus Topics Course details #AndroidApplicationDevelopment
  • [INTRO] Ethical hacking / cyber Security / Penetration testing Tutorial -{updates frequently}
  • redis install ubuntu 20.04 with wordpress php redis mysql configuration
  • ubuntu tutorials installation download issues etc
  • Php tutorials
  • HTML & CSS Tutorials
  • Core Java Tutorial Free online
  • Linux sysadmin tutorials linux system administrator
    • linux security limits.conf deciding user limits process limits for nginx server
    • remove repository ubuntu
    • increase open file limit linux File descriptor ft nginx , mysql, lemp
    • how to uninstall package in linux ubuntu rpm, yum apt-get
    • rsync command linux with examples comparison to scp
    • check linux version (lsb_release -a) ubuntu debian 32 or 64 bit
    • memcached install ubuntu wordpress
    • ping command
    • change ssh port in linux - avoid sshd ddos attacks
    • ddos attack prevention
    • ufw firewall commads allow port enable disable ubuntu 20.04
    • red hat linux certification cost jobs salary syllabus courses fees
    • ulimit linux unlimited command unlimto set & know user limits open files file descriptor max user process etc.
    • top 10 apt & apt-get commands (most used) apt vs apt-get
    • linux sysctl command tweaks & hardening
    • linux system specs commands (CPU, Memory, Disk )speed, type. manufacture
    • 3 Ways (SCP, rsync, Sftp) linux server migration between two remote server apache nginx
    • Upgrade Ubuntu from 18.04 (19.10) to 20.04 LTS command line or gui server | desktop
    • lsof netstat commands to know listening ports in linux 3 ways
    • Top 10 GREP Commands in linux to search files directory words strings
    • TOP 10 mv & cp commands in linux to move & copy files in Linux
    • Top 10 zip / tar commands to compress & extract files in linux
    • Ip tables / ufw / firewall d commands for block port ip rate limiting
    • Top 10 most used Cat commands with examples (create, view, append files)
    • linux performance tuning inode limit file descriptors tco, kernel etc
    • linux commands pdf (files & Directories, zip & unzip process, search etc)
  • apache server tutorial (install,config, performance tuning, security, error handling)

 

 

wordpress Pagespeed optimization

Digitalocean free $100 Credit

Cloudways Review pricing promo codes

Siteground cpu limits Pricing

Shared Hosting

Managed wordpress Hosting

Managed Hosting Cloud server

VPS Hosting

Cloud Hosting – Unmanaged

Google cloud Pricing

Aws Pricing

Azure pricing

nginx server tutorials

apache server tutorials

linux sysadmin tutorials

mysql Commands list pdf

LEMP Install Ubuntu

Mysql Performance Tuning

Nginx Performance tuning

Linux Performance tuning

Php -fpm performance tuning

Redis Performance tuning

linux server security

nginx security best practices

wordpress security plugins

 

 

wordpress

 

Top 5  WP Google Analytics Plugins

WP Backup Plugins

Wp Comment Plugins

Top wordpress Security Plugins

WP Seo Plugins

WP Caching Plugins

Best Adsense Plugins for WordPress

Wp social Sharing Plugins

autoshare social media plugins

WP speed Optimization Plugins

Speedup WordPress google Score

More Wp tuts

Server Admin Cloud

 

Installing Nginx LEMP On ubuntu

Installing apache Lamp ubuntu

nginx fastcgi cache enable

php – fpm install  & Configuration

Opcache install & Configure

php -fpm pool manager explained

Mysql Install & Configuration

Redis Object cache install & configure

 

Nginx as Reverse Proxy and Load balancer

Load Balance / auto scaling in google cloud

Linux Commands PDF

Mysql Commands Pdf

Letsencrypt tutorial

mysqldump export & import 

Pagespeed Module install & configure

nginx.conf best file

mysql.conf best file

upgrade ubuntu

© 2023 - All Rights Reserved Disclaimer & Privacy Policy