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?
- Connect to your server via SSH (more info).
- Switch to the root user (more info).
- Run the following command: vim /etc/ ssh /sshd_config.
- Locate the following line: # Port 22.
- Remove # and change 22 to your desired port number.
- Restart the sshd service by running the following command: service sshd restart.