{"id":166,"date":"2025-10-28T19:34:46","date_gmt":"2025-10-28T19:34:46","guid":{"rendered":"https:\/\/www.vm6.co.uk\/blog\/?p=166"},"modified":"2025-10-28T19:34:52","modified_gmt":"2025-10-28T19:34:52","slug":"how-to-change-ssh-port-linux","status":"publish","type":"post","link":"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/","title":{"rendered":"How to Change SSH Port on Linux: A Complete Security Guide"},"content":{"rendered":"\n<style>\n.ssh-guide-content pre {\n    background: #2d2d2d;\n    color: #f8f8f2;\n    padding: 15px;\n    border-radius: 5px;\n    overflow-x: auto;\n    margin: 15px 0;\n    border-left: 4px solid #00d4ff;\n}\n.ssh-guide-content code {\n    background: #f4f4f4;\n    color: #c7254e;\n    padding: 2px 6px;\n    border-radius: 3px;\n    font-family: 'Courier New', monospace;\n    font-size: 0.9em;\n}\n.ssh-guide-content pre code {\n    background: transparent;\n    color: #f8f8f2;\n    padding: 0;\n}\n.ssh-guide-content .warning-box {\n    background: #fff3cd;\n    border-left: 4px solid #ffc107;\n    padding: 15px;\n    margin: 20px 0;\n    border-radius: 4px;\n    color: #000;\n}\n.ssh-guide-content .info-box {\n    background: #d1ecf1;\n    border-left: 4px solid #17a2b8;\n    padding: 15px;\n    margin: 20px 0;\n    border-radius: 4px;\n    color: #000;\n}\n<\/style>\n\n<div class=\"ssh-guide-content\">\n<p>Changing your SSH port from the default port 22 is a crucial security measure that can significantly reduce automated attacks on your Linux server. This comprehensive guide will walk you through the entire process of changing your SSH port safely and effectively.<\/p>\n\n<h2>Why Change Your SSH Port?<\/h2>\n\n<p>The default SSH port (22) is constantly targeted by automated bots scanning for vulnerable servers. By changing to a non-standard port, you can:<\/p>\n\n<ul>\n    <li>Reduce automated brute-force attacks by up to 99%<\/li>\n    <li>Decrease server log clutter from failed login attempts<\/li>\n    <li>Add an extra layer of security through obscurity<\/li>\n    <li>Improve overall server security posture<\/li>\n<\/ul>\n\n<h2>Prerequisites<\/h2>\n\n<p>Before you begin, ensure you have:<\/p>\n\n<ul>\n    <li>Root or sudo access to your Linux server<\/li>\n    <li>An active SSH connection to your server<\/li>\n    <li>A backup of your SSH configuration file<\/li>\n    <li>Knowledge of your firewall configuration (iptables, UFW, or firewalld)<\/li>\n<\/ul>\n\n<div class=\"warning-box\">\n    <strong>\u26a0\ufe0f Warning:<\/strong> Never close your current SSH session until you&#8217;ve verified the new port works correctly, or you may lock yourself out of your server.\n<\/div>\n\n<h2>Step 1: Choose Your New SSH Port<\/h2>\n\n<p>Select a port number between 1024 and 65535 to avoid conflicts with well-known ports. Popular choices include:<\/p>\n\n<ul>\n    <li>2222<\/li>\n    <li>2200<\/li>\n    <li>22000<\/li>\n    <li>Any random high port number<\/li>\n<\/ul>\n\n<p>Avoid using ports already assigned to other services. You can check which ports are currently in use with:<\/p>\n\n<pre><code>sudo netstat -tulpn | grep LISTEN<\/code><\/pre>\n\n<p>Or alternatively:<\/p>\n\n<pre><code>sudo ss -tulpn | grep LISTEN<\/code><\/pre>\n\n<h2>Step 2: Backup Your SSH Configuration<\/h2>\n\n<p>Always create a backup before making changes:<\/p>\n\n<pre><code>sudo cp \/etc\/ssh\/sshd_config \/etc\/ssh\/sshd_config.backup<\/code><\/pre>\n\n<p>If something goes wrong, you can restore the original configuration:<\/p>\n\n<pre><code>sudo cp \/etc\/ssh\/sshd_config.backup \/etc\/ssh\/sshd_config<\/code><\/pre>\n\n<h2>Step 3: Edit the SSH Configuration File<\/h2>\n\n<p>Open the SSH daemon configuration file with your preferred text editor:<\/p>\n\n<pre><code>sudo nano \/etc\/ssh\/sshd_config<\/code><\/pre>\n\n<p>Or if you prefer vim:<\/p>\n\n<pre><code>sudo vim \/etc\/ssh\/sshd_config<\/code><\/pre>\n\n<p>Find the line that says:<\/p>\n\n<pre><code>#Port 22<\/code><\/pre>\n\n<p>Or simply:<\/p>\n\n<pre><code>Port 22<\/code><\/pre>\n\n<p>Change it to your chosen port number. For example, to use port 2222:<\/p>\n\n<pre><code>Port 2222<\/code><\/pre>\n\n<div class=\"info-box\">\n    <strong>\ud83d\udca1 Important:<\/strong> Remove the <code>#<\/code> symbol if present, as it comments out the line.\n<\/div>\n\n<h3>Optional: Run SSH on Multiple Ports Temporarily<\/h3>\n\n<p>For added safety during the transition, you can temporarily run SSH on both the old and new ports:<\/p>\n\n<pre><code>Port 22\nPort 2222<\/code><\/pre>\n\n<p>This allows you to test the new port while keeping the old one active. Once you&#8217;ve confirmed the new port works, remove the <code>Port 22<\/code> line.<\/p>\n\n<p>Save and exit the file (in nano: <code>Ctrl+X<\/code>, then <code>Y<\/code>, then <code>Enter<\/code>).<\/p>\n\n<h2>Step 4: Configure SELinux (If Applicable)<\/h2>\n\n<p>If your system uses SELinux (common on RHEL, CentOS, Rocky Linux, AlmaLinux), you must tell SELinux about the new port:<\/p>\n\n<p>First, check if SELinux is enabled:<\/p>\n\n<pre><code>sestatus<\/code><\/pre>\n\n<p>If SELinux is enabled, add the new port:<\/p>\n\n<pre><code>sudo semanage port -a -t ssh_port_t -p tcp 2222<\/code><\/pre>\n\n<p>Replace <code>2222<\/code> with your chosen port number.<\/p>\n\n<p>If the port is already defined, modify it instead:<\/p>\n\n<pre><code>sudo semanage port -m -t ssh_port_t -p tcp 2222<\/code><\/pre>\n\n<p>Verify the port was added:<\/p>\n\n<pre><code>sudo semanage port -l | grep ssh<\/code><\/pre>\n\n<h2>Step 5: Update Your Firewall Rules<\/h2>\n\n<p>Your firewall must allow traffic on the new SSH port. The commands depend on which firewall you&#8217;re using.<\/p>\n\n<h3>For UFW (Ubuntu\/Debian):<\/h3>\n\n<pre><code>sudo ufw allow 2222\/tcp\nsudo ufw status<\/code><\/pre>\n\n<p>Once you&#8217;ve confirmed the new port works, remove the old rule:<\/p>\n\n<pre><code>sudo ufw delete allow 22\/tcp<\/code><\/pre>\n\n<h3>For firewalld (RHEL\/CentOS\/Fedora):<\/h3>\n\n<pre><code>sudo firewall-cmd --permanent --add-port=2222\/tcp\nsudo firewall-cmd --reload\nsudo firewall-cmd --list-ports<\/code><\/pre>\n\n<p>After testing, remove the old port:<\/p>\n\n<pre><code>sudo firewall-cmd --permanent --remove-service=ssh\nsudo firewall-cmd --reload<\/code><\/pre>\n\n<h3>For iptables:<\/h3>\n\n<pre><code>sudo iptables -A INPUT -p tcp --dport 2222 -j ACCEPT\nsudo iptables -L -n | grep 2222<\/code><\/pre>\n\n<p>Save the rules (method varies by distribution):<\/p>\n\n<pre><code># Debian\/Ubuntu\nsudo iptables-save | sudo tee \/etc\/iptables\/rules.v4\n\n# RHEL\/CentOS\nsudo service iptables save<\/code><\/pre>\n\n<h3>For Cloud Providers<\/h3>\n\n<p>If you&#8217;re using a cloud provider (AWS, Google Cloud, Azure, DigitalOcean, etc.), you must also update the security group or firewall rules in your cloud console:<\/p>\n\n<ul>\n    <li>AWS: Update Security Group inbound rules<\/li>\n    <li>Google Cloud: Update Firewall rules<\/li>\n    <li>Azure: Update Network Security Group<\/li>\n    <li>DigitalOcean: Update Cloud Firewall rules<\/li>\n<\/ul>\n\n<h2>Step 6: Restart SSH Service<\/h2>\n\n<p>Restart the SSH daemon to apply changes:<\/p>\n\n<h3>For systemd-based systems (most modern distributions):<\/h3>\n\n<pre><code>sudo systemctl restart sshd<\/code><\/pre>\n\n<p>Check the status to ensure it started successfully:<\/p>\n\n<pre><code>sudo systemctl status sshd<\/code><\/pre>\n\n<h3>For older init-based systems:<\/h3>\n\n<pre><code>sudo service ssh restart<\/code><\/pre>\n\n<p>Or:<\/p>\n\n<pre><code>sudo service sshd restart<\/code><\/pre>\n\n<h2>Step 7: Test the New SSH Port<\/h2>\n\n<div class=\"warning-box\">\n    <strong>\u26a0\ufe0f Do not close your current SSH session yet!<\/strong> Open a new terminal window and test the connection:\n<\/div>\n\n<pre><code>ssh -p 2222 username@your_server_ip<\/code><\/pre>\n\n<p>Replace:<\/p>\n<ul>\n    <li><code>2222<\/code> with your chosen port<\/li>\n    <li><code>username<\/code> with your actual username<\/li>\n    <li><code>your_server_ip<\/code> with your server&#8217;s IP address or domain<\/li>\n<\/ul>\n\n<p>If the connection succeeds, congratulations! Your new SSH port is working correctly.<\/p>\n\n<h3>Troubleshooting Connection Issues<\/h3>\n\n<p>If you cannot connect, check the following:<\/p>\n\n<p><strong>1. Verify SSH is listening on the new port:<\/strong><\/p>\n<pre><code>sudo ss -tlnp | grep sshd<\/code><\/pre>\n\n<p><strong>2. Check SSH service logs:<\/strong><\/p>\n<pre><code>sudo journalctl -u sshd -n 50<\/code><\/pre>\n\n<p>Or:<\/p>\n<pre><code>sudo tail -f \/var\/log\/auth.log<\/code><\/pre>\n\n<p><strong>3. Verify firewall rules:<\/strong><\/p>\n<pre><code>sudo ufw status verbose  # For UFW\nsudo firewall-cmd --list-all  # For firewalld\nsudo iptables -L -n  # For iptables<\/code><\/pre>\n\n<p><strong>4. Check SELinux status:<\/strong><\/p>\n<pre><code>sudo ausearch -m avc -ts recent<\/code><\/pre>\n\n<h2>Step 8: Update SSH Client Configuration<\/h2>\n\n<p>To avoid typing the port number every time, update your local SSH config file on your client machine (not the server):<\/p>\n\n<pre><code>nano ~\/.ssh\/config<\/code><\/pre>\n\n<p>Add the following:<\/p>\n\n<pre><code>Host your_server_name\n    HostName your_server_ip\n    Port 2222\n    User your_username<\/code><\/pre>\n\n<p>Now you can connect simply with:<\/p>\n\n<pre><code>ssh your_server_name<\/code><\/pre>\n\n<h2>Step 9: Update Any Automated Scripts<\/h2>\n\n<p>Don&#8217;t forget to update any scripts or tools that connect to your server via SSH:<\/p>\n\n<ul>\n    <li>Backup scripts<\/li>\n    <li>Deployment tools (Ansible, Capistrano, etc.)<\/li>\n    <li>Git remote repositories<\/li>\n    <li>FTP\/SFTP clients<\/li>\n    <li>Monitoring tools<\/li>\n    <li>Cron jobs<\/li>\n<\/ul>\n\n<p>For Git repositories using SSH, update the remote URL:<\/p>\n\n<pre><code>git remote set-url origin ssh:\/\/git@your_server_ip:2222\/path\/to\/repo.git<\/code><\/pre>\n\n<h2>Step 10: Remove the Old Port (Optional)<\/h2>\n\n<p>Once you&#8217;ve thoroughly tested the new port and updated all your tools, you can remove SSH access on port 22:<\/p>\n\n<ol>\n    <li>Edit <code>\/etc\/ssh\/sshd_config<\/code> and remove <code>Port 22<\/code> if you added multiple ports<\/li>\n    <li>Remove firewall rules for port 22 (shown in Step 5)<\/li>\n    <li>Restart SSH service<\/li>\n<\/ol>\n\n<h2>Additional Security Recommendations<\/h2>\n\n<p>While changing the SSH port improves security, consider implementing these additional measures:<\/p>\n\n<h3>Disable Password Authentication<\/h3>\n\n<p>Use SSH keys instead:<\/p>\n\n<pre><code>sudo nano \/etc\/ssh\/sshd_config<\/code><\/pre>\n\n<p>Set:<\/p>\n<pre><code>PasswordAuthentication no\nPubkeyAuthentication yes<\/code><\/pre>\n\n<h3>Disable Root Login<\/h3>\n\n<pre><code>PermitRootLogin no<\/code><\/pre>\n\n<h3>Use SSH Key Authentication<\/h3>\n\n<p>Generate an SSH key pair on your local machine:<\/p>\n\n<pre><code>ssh-keygen -t ed25519 -C \"your_email@example.com\"<\/code><\/pre>\n\n<p>Copy it to your server:<\/p>\n\n<pre><code>ssh-copy-id -p 2222 username@your_server_ip<\/code><\/pre>\n\n<h3>Install Fail2Ban<\/h3>\n\n<p>Fail2Ban automatically blocks IP addresses after multiple failed login attempts:<\/p>\n\n<pre><code>sudo apt install fail2ban  # Debian\/Ubuntu\nsudo yum install fail2ban  # RHEL\/CentOS<\/code><\/pre>\n\n<p>Configure it to monitor your new SSH port by editing <code>\/etc\/fail2ban\/jail.local<\/code>:<\/p>\n\n<pre><code>[sshd]\nenabled = true\nport = 2222<\/code><\/pre>\n\n<h3>Enable Two-Factor Authentication<\/h3>\n\n<p>Add an extra layer of security with Google Authenticator or similar:<\/p>\n\n<pre><code>sudo apt install libpam-google-authenticator  # Debian\/Ubuntu\nsudo yum install google-authenticator  # RHEL\/CentOS<\/code><\/pre>\n\n<h2>Common Issues and Solutions<\/h2>\n\n<h3>Issue: Cannot connect after changing port<\/h3>\n\n<p><strong>Solution:<\/strong> Check if SSH is running on the new port using <code>sudo ss -tlnp | grep sshd<\/code>. Verify your firewall allows the new port. If using a cloud provider, check security group rules.<\/p>\n\n<h3>Issue: SELinux is blocking connections<\/h3>\n\n<p><strong>Solution:<\/strong> Run <code>sudo ausearch -m avc -ts recent<\/code> to check for denials. Ensure you&#8217;ve added the port to SELinux using <code>semanage port -a<\/code>.<\/p>\n\n<h3>Issue: Locked out of the server<\/h3>\n\n<p><strong>Solution:<\/strong> If you have console access (like through a cloud provider&#8217;s web console), log in and revert the SSH configuration using the backup. If not, you may need to contact your hosting provider.<\/p>\n\n<h2>Conclusion<\/h2>\n\n<p>Changing your SSH port is a simple yet effective security measure that significantly reduces automated attacks on your Linux server. By following this guide, you&#8217;ve successfully moved SSH to a custom port, updated your firewall, and tested the configuration.<\/p>\n\n<p>Remember to keep your SSH client configurations and automated tools updated with the new port number. For maximum security, combine this change with SSH key authentication, Fail2Ban, and regular security updates.<\/p>\n\n<h2>Quick Reference Commands<\/h2>\n\n<pre><code># Backup SSH config\nsudo cp \/etc\/ssh\/sshd_config \/etc\/ssh\/sshd_config.backup\n\n# Edit SSH config\nsudo nano \/etc\/ssh\/sshd_config\n\n# Add SELinux port (if applicable)\nsudo semanage port -a -t ssh_port_t -p tcp 2222\n\n# Allow firewall port\nsudo ufw allow 2222\/tcp  # UFW\nsudo firewall-cmd --permanent --add-port=2222\/tcp && sudo firewall-cmd --reload  # firewalld\n\n# Restart SSH\nsudo systemctl restart sshd\n\n# Test connection (from another terminal)\nssh -p 2222 username@server_ip\n\n# Check if SSH is listening\nsudo ss -tlnp | grep sshd<\/code><\/pre>\n\n<hr>\n\n<p><strong>About VM6 Networks:<\/strong> This guide is brought to you by VM6 Networks, your trusted resource for WordPress hosting security and Linux server management tips. Stay secure and keep your servers protected!<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Changing your SSH port from the default port 22 is a crucial security measure that can significantly reduce automated attacks on your Linux server. This comprehensive guide will walk you&#8230; <a href=\"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/\" class=\"read-more\" style=\"color: #fbbf24;\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":172,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mbp_gutenberg_autopost":false,"footnotes":""},"categories":[44,2],"tags":[45,25,46,47,20],"class_list":["post-166","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dedicated-servers","category-vps-hosting","tag-change","tag-linux","tag-port","tag-server","tag-ssh"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.1.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Change SSH Port in Linux - Blog - VM6 Networks<\/title>\n<meta name=\"description\" content=\"Learn how to change your SSH port on Linux to improve server security. Step-by-step guide with firewall configuration, SELinux setup, and troubleshooting.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Change SSH Port in Linux - Blog - VM6 Networks\" \/>\n<meta property=\"og:description\" content=\"Learn how to change your SSH port on Linux to improve server security. Step-by-step guide with firewall configuration, SELinux setup, and troubleshooting.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"VM6 Networks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/profile.php?id=61567167860081\" \/>\n<meta property=\"article:published_time\" content=\"2025-10-28T19:34:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-28T19:34:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.vm6.co.uk\/blog\/wp-content\/uploads\/2025\/10\/sshport.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1536\" \/>\n\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Rob\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vm6uk\" \/>\n<meta name=\"twitter:site\" content=\"@vm6uk\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rob\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/\"},\"author\":{\"name\":\"Rob\",\"@id\":\"https:\/\/www.vm6.co.uk\/blog\/#\/schema\/person\/73944405d16ba2f72183539123b66914\"},\"headline\":\"How to Change SSH Port on Linux: A Complete Security Guide\",\"datePublished\":\"2025-10-28T19:34:46+00:00\",\"dateModified\":\"2025-10-28T19:34:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/\"},\"wordCount\":1044,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.vm6.co.uk\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.vm6.co.uk\/blog\/wp-content\/uploads\/2025\/10\/sshport.jpg\",\"keywords\":[\"Change\",\"Linux\",\"Port\",\"Server\",\"SSH\"],\"articleSection\":[\"Dedicated Servers\",\"VPS Hosting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/\",\"url\":\"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/\",\"name\":\"How to Change SSH Port in Linux - Blog - VM6 Networks\",\"isPartOf\":{\"@id\":\"https:\/\/www.vm6.co.uk\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.vm6.co.uk\/blog\/wp-content\/uploads\/2025\/10\/sshport.jpg\",\"datePublished\":\"2025-10-28T19:34:46+00:00\",\"dateModified\":\"2025-10-28T19:34:52+00:00\",\"description\":\"Learn how to change your SSH port on Linux to improve server security. Step-by-step guide with firewall configuration, SELinux setup, and troubleshooting.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/#primaryimage\",\"url\":\"https:\/\/www.vm6.co.uk\/blog\/wp-content\/uploads\/2025\/10\/sshport.jpg\",\"contentUrl\":\"https:\/\/www.vm6.co.uk\/blog\/wp-content\/uploads\/2025\/10\/sshport.jpg\",\"width\":1536,\"height\":1024},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vm6.co.uk\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Change SSH Port on Linux: A Complete Security Guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vm6.co.uk\/blog\/#website\",\"url\":\"https:\/\/www.vm6.co.uk\/blog\/\",\"name\":\"Hosting Blog\",\"description\":\"Web Hosting Blog\",\"publisher\":{\"@id\":\"https:\/\/www.vm6.co.uk\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.vm6.co.uk\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.vm6.co.uk\/blog\/#organization\",\"name\":\"VM6 Networks\",\"url\":\"https:\/\/www.vm6.co.uk\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vm6.co.uk\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vm6.co.uk\/blog\/wp-content\/uploads\/2025\/08\/logo@2x3.png\",\"contentUrl\":\"https:\/\/www.vm6.co.uk\/blog\/wp-content\/uploads\/2025\/08\/logo@2x3.png\",\"width\":572,\"height\":70,\"caption\":\"VM6 Networks\"},\"image\":{\"@id\":\"https:\/\/www.vm6.co.uk\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/profile.php?id=61567167860081\",\"https:\/\/x.com\/vm6uk\",\"https:\/\/www.linkedin.com\/company\/vm6networks?trk=public_post_follow-view-profile\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.vm6.co.uk\/blog\/#\/schema\/person\/73944405d16ba2f72183539123b66914\",\"name\":\"Rob\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vm6.co.uk\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/76cb301db25481fbcf2aa24bffe0fdf3d3e7002d35ed6d48554b341e501e3192?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/76cb301db25481fbcf2aa24bffe0fdf3d3e7002d35ed6d48554b341e501e3192?s=96&d=mm&r=g\",\"caption\":\"Rob\"},\"sameAs\":[\"https:\/\/www.vm6.co.uk\/blog\"],\"url\":\"https:\/\/www.vm6.co.uk\/blog\/author\/rob\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Change SSH Port in Linux - Blog - VM6 Networks","description":"Learn how to change your SSH port on Linux to improve server security. Step-by-step guide with firewall configuration, SELinux setup, and troubleshooting.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/","og_locale":"en_US","og_type":"article","og_title":"How to Change SSH Port in Linux - Blog - VM6 Networks","og_description":"Learn how to change your SSH port on Linux to improve server security. Step-by-step guide with firewall configuration, SELinux setup, and troubleshooting.","og_url":"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/","og_site_name":"VM6 Networks","article_publisher":"https:\/\/www.facebook.com\/profile.php?id=61567167860081","article_published_time":"2025-10-28T19:34:46+00:00","article_modified_time":"2025-10-28T19:34:52+00:00","og_image":[{"width":1536,"height":1024,"url":"https:\/\/www.vm6.co.uk\/blog\/wp-content\/uploads\/2025\/10\/sshport.jpg","type":"image\/jpeg"}],"author":"Rob","twitter_card":"summary_large_image","twitter_creator":"@vm6uk","twitter_site":"@vm6uk","twitter_misc":{"Written by":"Rob","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/#article","isPartOf":{"@id":"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/"},"author":{"name":"Rob","@id":"https:\/\/www.vm6.co.uk\/blog\/#\/schema\/person\/73944405d16ba2f72183539123b66914"},"headline":"How to Change SSH Port on Linux: A Complete Security Guide","datePublished":"2025-10-28T19:34:46+00:00","dateModified":"2025-10-28T19:34:52+00:00","mainEntityOfPage":{"@id":"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/"},"wordCount":1044,"commentCount":0,"publisher":{"@id":"https:\/\/www.vm6.co.uk\/blog\/#organization"},"image":{"@id":"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/www.vm6.co.uk\/blog\/wp-content\/uploads\/2025\/10\/sshport.jpg","keywords":["Change","Linux","Port","Server","SSH"],"articleSection":["Dedicated Servers","VPS Hosting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/","url":"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/","name":"How to Change SSH Port in Linux - Blog - VM6 Networks","isPartOf":{"@id":"https:\/\/www.vm6.co.uk\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/#primaryimage"},"image":{"@id":"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/www.vm6.co.uk\/blog\/wp-content\/uploads\/2025\/10\/sshport.jpg","datePublished":"2025-10-28T19:34:46+00:00","dateModified":"2025-10-28T19:34:52+00:00","description":"Learn how to change your SSH port on Linux to improve server security. Step-by-step guide with firewall configuration, SELinux setup, and troubleshooting.","breadcrumb":{"@id":"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/#primaryimage","url":"https:\/\/www.vm6.co.uk\/blog\/wp-content\/uploads\/2025\/10\/sshport.jpg","contentUrl":"https:\/\/www.vm6.co.uk\/blog\/wp-content\/uploads\/2025\/10\/sshport.jpg","width":1536,"height":1024},{"@type":"BreadcrumbList","@id":"https:\/\/www.vm6.co.uk\/blog\/2025\/10\/28\/how-to-change-ssh-port-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vm6.co.uk\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Change SSH Port on Linux: A Complete Security Guide"}]},{"@type":"WebSite","@id":"https:\/\/www.vm6.co.uk\/blog\/#website","url":"https:\/\/www.vm6.co.uk\/blog\/","name":"Hosting Blog","description":"Web Hosting Blog","publisher":{"@id":"https:\/\/www.vm6.co.uk\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vm6.co.uk\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.vm6.co.uk\/blog\/#organization","name":"VM6 Networks","url":"https:\/\/www.vm6.co.uk\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vm6.co.uk\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.vm6.co.uk\/blog\/wp-content\/uploads\/2025\/08\/logo@2x3.png","contentUrl":"https:\/\/www.vm6.co.uk\/blog\/wp-content\/uploads\/2025\/08\/logo@2x3.png","width":572,"height":70,"caption":"VM6 Networks"},"image":{"@id":"https:\/\/www.vm6.co.uk\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/profile.php?id=61567167860081","https:\/\/x.com\/vm6uk","https:\/\/www.linkedin.com\/company\/vm6networks?trk=public_post_follow-view-profile"]},{"@type":"Person","@id":"https:\/\/www.vm6.co.uk\/blog\/#\/schema\/person\/73944405d16ba2f72183539123b66914","name":"Rob","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vm6.co.uk\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/76cb301db25481fbcf2aa24bffe0fdf3d3e7002d35ed6d48554b341e501e3192?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/76cb301db25481fbcf2aa24bffe0fdf3d3e7002d35ed6d48554b341e501e3192?s=96&d=mm&r=g","caption":"Rob"},"sameAs":["https:\/\/www.vm6.co.uk\/blog"],"url":"https:\/\/www.vm6.co.uk\/blog\/author\/rob\/"}]}},"_links":{"self":[{"href":"https:\/\/www.vm6.co.uk\/blog\/wp-json\/wp\/v2\/posts\/166","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vm6.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vm6.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vm6.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vm6.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=166"}],"version-history":[{"count":5,"href":"https:\/\/www.vm6.co.uk\/blog\/wp-json\/wp\/v2\/posts\/166\/revisions"}],"predecessor-version":[{"id":171,"href":"https:\/\/www.vm6.co.uk\/blog\/wp-json\/wp\/v2\/posts\/166\/revisions\/171"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.vm6.co.uk\/blog\/wp-json\/wp\/v2\/media\/172"}],"wp:attachment":[{"href":"https:\/\/www.vm6.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=166"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vm6.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=166"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vm6.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}