Changing ssh port to improve security

November 28, 2008 - Views: 773
Category: Linux Daemons

For security reasons, it’s advisable to change the ssh standard port 22 into something else. So you will get less attacks to sshd. This improves the security for your server. Furthermore, you should block root from connecting via ssh.

Open your /etc/ssh/sshd_config
Changing the port:

# This is the sshd server system-wide configuration file. See sshd(8)
# for more information.

# change the port configuration – for example to 2233
Port 2233
Protocol 2

And blocking user root

#
PermitRootLogin without-password
PermitRootLogin no
#

You need to restart the sshd script with /etc/init.d/sshd restart Please stay logged in as root, before you’ve tested the new ssh – connect with a second console.

Now create an user account with lower permissions than root. Use this account to connect your server via ssh, followed by the “su” command to get root permissions.


useradd -u 999 -g 100 remotessh -d /home/remotessh -s /bin/bash

Connecting your server with the new port:

ssh -P 2233 yourserver.com -l remotessh

Setting up a firewall with iptables to improve systems security will bei shown in this article

Helpful links:

  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • MisterWong
  • Yigg
  • Technorati
  • Blogosphere News
  • LinkArena
  • Webnews.de

Tags: , ,

Related Posts:

2 Responses

  1. drexler76

    December 1st, 2008

    nice hint, thank’s a lot.

  2. [...] ssh port is bind to another one, because of improving security. The last step to complete the script is the [...]

Leave a Reply

Home | Imprint | Impressum | Archiv
© 2008 M.Sc. Dipl.Inf. Michael Kolb. Powered by Wordpress. HTML CSS
my technorati | my blogcatalog