How to change the ssh port on Linux or Unix server

#1

Originally published at: https://www.cyberciti.biz/faq/howto-change-ssh-port-on-linux-or-unix-server/

I am a new Linux/Unix server admin. How do I change the SSH Port for my Linux or Unix server using command line option?

0 Likes

#2
  1. Connect to your server via SSH (more info).
  2. Switch to the root user (more info).
  3. Run the following command: vim /etc/ ssh /sshd_config.
  4. Locate the following line: # Port 22.
  5. Remove # and change 22 to your desired port number.
  6. Restart the sshd service by running the following command: service sshd restart.
0 Likes