Change the SSH Port on Dedicated and VPS. Change the SSH Port in Linux?

Subscribers:
4,200
Published on ● Video Link: https://www.youtube.com/watch?v=6p4Qkt0_xIQ



Duration: 2:10
4 views
0


Here's how to Change the SSH Port on Dedicated and VPS.

i. Changing the SSH port on a Linux system involves modifying the SSH daemon configuration file. Here are the steps to change the SSH port:

### 1. **Connect to the Server:**
- Connect to your Linux server using SSH with the current port. For example:
```bash
ssh username@your_server_ip
```

### 2. **Edit the SSH Configuration File:**
- Open the SSH daemon configuration file using a text editor. The location of the configuration file may vary, but it is commonly found at `/etc/ssh/sshd_config`. Use a text editor such as `nano` or `vi`. For example:
```bash
sudo nano /etc/ssh/sshd_config
```

### 3. **Locate the Port Configuration:**
- Look for the line that specifies the SSH port. The default is usually:
```conf
Port 22
```
Change the number (22) to your desired port number.

### 4. **Choose a New Port:**
- Choose a new port number between 1024 and 65535. Avoid using well-known ports or ports already assigned to other services.

### 5. **Save and Close the File:**
- Save the changes and close the text editor.

- For `nano`, press `Ctrl + X`, then press `Y` to confirm changes, and finally press `Enter`.
- For `vi`, press `Esc`, then type `:wq` and press `Enter`.

### 6. **Restart the SSH Service:**
- Restart the SSH service to apply the changes:
```bash
sudo service ssh restart
```
or
```bash
sudo systemctl restart ssh
```

### 7. **Verify the New Port:**
- Try to reconnect to the server using the new port:
```bash
ssh -p your_new_port username@your_server_ip
```
Replace `your_new_port` with the chosen port number.

### 8. **Update Firewall Rules:**
- If you have a firewall enabled, update its rules to allow traffic on the new SSH port. For example, if using `ufw`:
```bash
sudo ufw allow your_new_port
```

### Important Considerations:
- Ensure that the chosen port is not blocked by firewalls, and it is allowed by your hosting provider if applicable.
- Always choose a strong, unique port number to enhance security.
- Make sure you update your SSH client configuration if needed, especially if you are using tools like PuTTY.

Changing the SSH port is a security measure, but it's important to keep track of the new port to avoid connectivity issues.




Other Videos By HowtoFixDllExeErrors


2024-02-03Steam Workshop 101: workshop steam downloader? steam workshop hidden vs unliste? Mods on Steam?
2024-02-02Steam Community 101: steam community downloader? steam community search users?
2024-02-01Steam hentai games 101: Top games tagged Hentai?
2024-01-31Steam free ones 101: get all steam games free​? free steam game download? freefire on steam​?
2024-01-30Steam Community market 101: Community market fee? Steam community downloader?
2024-01-29Manage Paypal payment? Cancel Paypal payment? cancel a recurring payment?
2024-01-28Unsubscribe Hostgator via PayPal. how to cancel gator account? cancel web hosting account?
2024-01-27Upload Files to Hostgator cPanel Using File Manager. Hostgator startup guide?
2024-01-26Use Robots.txt. user agent disallow robots txt​? how to find robot txt​? robots txt block all?
2024-01-25Check the SSL Information of Websites. SSL Certificate Checker? ssl configuration checker?
2024-01-23Change the SSH Port on Dedicated and VPS. Change the SSH Port in Linux?
2024-01-22Get started w/ Roundcube webmail fast. Roundcube webmail homestead?
2024-01-21phpMyAdmin 101: get started it in minutes? Install phpMyAdmin on Windows 10? phpmyadmin portal?
2024-01-20Google Circle to Search 101: getting started w/ it; how it works.
2024-01-20Flush DNS on Windows/Mac/Linux/Andoid/iOS. Flush website DNS​?
2024-01-19Transferring Domain Registration Away From GoDaddy. Domain Transfer deals?
2024-01-18What's Godaddy Whois? WHOIS SSL?
2024-01-17Access Apache log files. Apache log files location centros? Apache log file analyzer​? apache log %d
2024-01-16Site Down? Cannot See Website? Is the/this website down?
2024-01-15Microsoft 365: Initial Login and Password Reset. Reset Microsoft password? Microsoft password reset?
2024-01-14Get started w/ HostGator cPanel