{"id":7633,"date":"2024-01-23T15:47:47","date_gmt":"2024-01-23T10:17:47","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=7633"},"modified":"2024-01-23T17:54:36","modified_gmt":"2024-01-23T12:24:36","slug":"how-to-ssh-remote-server-via-terminal","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/how-to-ssh-remote-server-via-terminal\/","title":{"rendered":"How to SSH remote server via Terminal"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\"><strong>Introduction<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">SSH or Secure Shell is a cryptographic network protocol that provides a secure way to access and manage network devices and servers over an unsecured network. It is widely used for securely connecting to remote systems, executing commands, and transferring files.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Prerequisites<\/strong><\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li>IP address or hostname of the remote server&nbsp;<\/li>\n\n\n\n<li>Username<\/li>\n\n\n\n<li>Password or SSH key -You need either the password associated with the username or an SSH key pair for authentication.<\/li>\n\n\n\n<li>Port number required only for pointing to other ports or other wise the server automatically assumes the default port is 22.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Implementation :<\/strong><\/h2>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Without port number (Default port 22):<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>For Password Authentication:<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Open your Terminal\/Command Line and run the following command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ssh username@ip_address_or_hostname<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the connection is successful, you should now be logged into the remote server via SSH.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>For Key-Based Authentication:<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Open your Terminal and use the following command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ssh -i \/path\/to\/private_key username@ip_address_or_hostname<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the connection is successful, you should now be logged into the remote server via SSH.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>With port number (SSH port is configured with random port):<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>For Password Authentication:<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Open your Terminal and use the following command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ssh username@ip_address_or_hostname -p &lt;portnumber&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the connection is successful, you should now be logged into the remote server via SSH.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>For Key-Based Authentication:<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&nbsp;<\/strong>Open your Terminal and use the following command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ssh -i \/path\/to\/private_key username@ip_address_or_hostname -p &lt;port number&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the connection is successful, you should now be logged into the remote server via SSH.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Note : <br>Remove with <br>1. \u201cusername\u201d&nbsp; with your actual username<br>2. &nbsp;\u201cip_address_or_hostname\u201d with the IP address or hostname of the remote server.<br>3. &#8220;port number&#8221; with actual pointing port number.<br>4. \u201c\/path\/to\/private_key\u201d with the actual path\/folders to your private key file.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction SSH or Secure Shell is a cryptographic network protocol that provides a secure way to access and manage network [&hellip;]<\/p>\n","protected":false},"author":509,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[],"class_list":["post-7633","post","type-post","status-publish","format-standard","hentry","category-web-architecture","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-1Z7","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7633","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/509"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=7633"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7633\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=7633"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=7633"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=7633"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}