• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

Change the default port number of ssh server

June 25, 2013 by Sharad Chhetri Leave a Comment

Change the default port number of ssh server

SSH Default Port no. = 22

To change the default port number of ssh server hardly takes a few steps but with the point of security it is important to change the default port no. 22

After this you can also use the anti port scan script which is already written in post. (Reference : note; change the port no. of ssh (22) as per your requirement Restrict Port Scanning IPTABLE script )

Follow the given below steps to change the port no. of ssh

Step 1 : Open the file /etc/ssh/sshd_config with the help of your favorite 🙂 editor. I use vi editor

Step 2: Search the line “Port 22” and the change the value of 22 to any number, here I am using 2786

vi /etc/ssh/sshd_config 

Port 2786

Step 3: After save and exit. Restart the ssh service.

In CentOS and Red Hat

/etc/init.d/sshd restart
In Ubuntu and Debian

/etc/init.d/ssh restart

Now how to access from client

Now from your client machine for ssh you have to use flag -p and for scp -P

eg.

ssh -p 2786 username@ssh-server

scp -P 2786 filename username@ssh-server:~

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. Change mysql default port number in linux
  2. Change telnet server port number on CentOS 7 / RHEL 7
  3. Change default editor of crontab in Ubuntu
  4. How to change smtp port number 25 in postfix
  5. CentOS 7 / RHEL 7 : change OpenSSH port number ( SELINUX enabled )
  6. How to change mysql default data directory in Ubuntu
  7. rsync over ssh port number on Linux/Unix system
  8. How to change Port number for Octopress rake preview
  9. Non interactive ,without typing password do ssh to Server : By sshpass
  10. how to deny root ssh access in linux server

Filed Under: Linux, SSH, Tips And Tricks Tagged With: ssh

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

Yum Error database disk image is malformed

How to install korn shell ksh in Linux

safest method to remove softlink in linux

How to install pam_mysql in CentOS or Red Hat

How to convert rpm file into deb file

Nagios HTTP WARNING: HTTP/1.1 403 Forbidden

How to add/install Ubuntu fonts in CentOS/Red Hat Linux

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ·
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy