Results 1 to 2 of 2

Thread: Changing your SSH port

  1. #1
    phauk's Avatar Poster
    Join Date
    Dec 2009
    Location
    scotland.
    Posts
    113

    Urgent

    Assuming you have already logged into the server, run the following command to locate your SSHd config file:

    locate sshd_config

    That command will give you the location of your SSHd config file, usually /etc/ssh/sshd_config.

    Now open up that config file using your favorite text editor, we'll use nano.

    nano /etc/ssh/sshd_config

    The bit of information we're interested in looks like this:

    #port 22

    Change that to:

    port [port_number]

    Replace [port_number] with a random 4 digit number, one you will not forget (ie. port 999).

    Save the file, exit the editor, and run this command:

    /etc/init.d/ssh restart

    If that command gives you an error, try:

    /etc/init.d/sshd restart

    Assuming you edited the sshd_config file properly, the SSH daemon service should now restart, and you can SSH into your server with your new port.

    This will immensely reduces hackers being able to penetrate your box and don't lose your servers full potential.

    You can see the last people to log into your server, and when by typing: lastlog

    Enjoy.

  2. Guides and Tutorials   -   #2
    lightshow's Avatar Asleep at the wheel
    Join Date
    Mar 2003
    Age
    39
    Posts
    902
    That's a good tip. It would help fight against all those automated port scanners. Now, just to check to make sure

    permitrootlogin=no

    lol
    I miss the days of random nut '03
    Click for more activation options, then activate by telephone. Run the keygen.
    if I call them, aren't they going to get me? (you know, down there)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •