• About
  • Arts
  • Video / Photos
  • Contact us
Linux Servers cPanel webhosting blog
Basics cPanel tutorials / issue,mysql,php errors etc
Home

How to restrict and secure SSH access?

By Gunjan · November 6, 2009

To restrict and secure SSH access, bind SSHD to a single IP that is different than the main IP to the server, and on a different port than port 22.

SSH into server and login as root user

Once logged in in command prompt type:

root@admin[]#pico /etc/ssh/sshd_config

Scroll down to the section of the file that looks like this:
Code:

#Port 22
#Protocol 2, 1
#ListenAddress 0.0.0.0
#ListenAddress ::

Uncomment and change

#Port 22

to look like

Port 5678 (choose your own 4 to 5 digit port number (49999 is the highest port number)

Uncomment and change

#Protocol 2, 1

to look like remove 1 from above line

Protocol 2

Uncomment and change

#ListenAddress 0.0.0.0

to look like as follows

ListenAddress 115.186.0.2 (use one of your own IP Addresses that has been assigned to your server,if you are not sure about your local machine ip then browse the URLĀ  http://whatismyip.com/)

Note 1: If you would like to disable direct Root Login, scroll down until you find

#PermitRootLogin yes

and uncomment it and make it look like

PermitRootLogin no

Save by pressing Ctrl o on your keyboard, and then exit by pressing Ctrl x on your keyboard.

Once file save restart SSHD service

root@admin[]# /etc/rc.d/init.d/sshd restart

Do not Logout from current SSH first try to connect Server from duplicate session , and then re-login to SSH using the new IP or nameserver, and the new port.

delicious | digg | reddit | facebook | technorati | stumbleupon | savetheurl
Category: Server Security, VPS  Tags: change default ssh port, disable root login.enable another port for ssh, local machine ip checker, ssh port, sshd restart
You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.
One Response
  1. How to restrict and secure SSH access? | Linux Servers cPanel … | Linux Affinity says:
    November 18, 2009 at 1:55 pm

    [...] more here: How to restrict and secure SSH access? | Linux Servers cPanel … Posted in: Server ADD [...]

« Stop hotlinking from outside domains by using .htaccess?
How to check process id for services? »
  • The Perfect Forum

    • .htaccess (10)
    • Basic Linux (56)
    • Browser problems (3)
    • Common errors (10)
    • cPanel + cPanel scripts (24)
    • Cron jobs issue (4)
    • Dedicated Server Issue (5)
    • Definition / Explanation (5)
    • E-mails issue (16)
    • Enable private PHP (5)
    • Few good queries and suggestions (12)
    • FTP / Frontpage / Dreamweaver (10)
    • General (3)
    • HTML/PHP issue (1)
    • Install server side software / script (14)
    • Linux Administrator Interview Questions (61)
    • Linux Permissions (8)
    • Mailman (1)
    • Mysql + phpmyadmin (15)
    • NFS server (6)
    • PHP (7)
    • Plesk (10)
    • scripts (3)
    • Server Security (20)
    • Third party script issue (13)
    • Tomcat (1)
    • Uncategorized (19)
    • VPS (46)
  • Archives

  • Tag you need to know

    .htaccess .htaccess file /etc/ssh/sshd_config /var/cpanel/cpanel.config Access denied for user 'root'@'localhost' AddHandler + Safari browser problem cgi script clear cache cPanel access logs cPanel error logs cPanel exim logs cPanel logs cPanel servers logs Create new FTP account from cPanel Disable directory listing exim logs find command mysql from WHM mysql has failed mysql service mysql service from WHM nameserver setup Network File System NFS Server php form phpmail() form phpmail function please contact the sysadmin plesk panel issue roundcube roundcube error roundcube error logs Safari browser Safari browser + AddHandler Safari browser + AddHandler application/x-httpd-php5 Safari browser downloading .html pages. Safari browser downloading pages Safari downloading pages simple php form simple phpmail() form simple phpmail function form sshd restart suexec trueuserdomains using the NFS Server
  • Email Subscription Request

    FBF ▪ Powered by ®Google Feedburner

  • Tag

    .htaccess .htaccess file /etc/ssh/sshd_config /var/cpanel/cpanel.config Access denied for user 'root'@'localhost' AddHandler + Safari browser problem cgi script clear cache cPanel access logs cPanel error logs cPanel exim logs cPanel logs cPanel servers logs Create new FTP account from cPanel Disable directory listing exim logs find command mysql from WHM mysql has failed mysql service mysql service from WHM nameserver setup Network File System NFS Server php form phpmail() form phpmail function please contact the sysadmin plesk panel issue roundcube roundcube error roundcube error logs Safari browser Safari browser + AddHandler Safari browser + AddHandler application/x-httpd-php5 Safari browser downloading .html pages. Safari browser downloading pages Safari downloading pages simple php form simple phpmail() form simple phpmail function form sshd restart suexec trueuserdomains using the NFS Server

    .htaccess (10)
    Basic Linux (56)
    Browser problems (3)
    Common errors (10)
    cPanel + cPanel scripts (24)
    Cron jobs issue (4)
    Dedicated Server Issue (5)
    Definition / Explanation (5)
    E-mails issue (16)
    Enable private PHP (5)
    Few good queries and suggestions (12)
    FTP / Frontpage / Dreamweaver (10)
    General (3)
    HTML/PHP issue (1)
    Install server side software / script (14)
    Linux Administrator Interview Questions (61)
    Linux Permissions (8)
    Mailman (1)
    Mysql + phpmyadmin (15)
    NFS server (6)
    PHP (7)
    Plesk (10)
    scripts (3)
    Server Security (20)
    Third party script issue (13)
    Tomcat (1)
    Uncategorized (19)
    VPS (46)

    WP-Cumulus by Roy Tanck and Luke Morton requires Flash Player 9 or better.

  • Blogroll

    • Check it 9
    • Development Arts This is the best Arts… 9
    • Documentation You like to watch it once in your life 0
    • Themes Check out best Arts and choose it for you.. 0
  • Search: the web pages

© 2012 - Linux Servers cPanel webhosting blog is proudly powered by WordPress
Best Wordpress Web Hosting provided by dedicated server & Web Hosting