{"id":323,"date":"2021-11-04T11:46:14","date_gmt":"2021-11-04T11:46:14","guid":{"rendered":"https:\/\/christianwebhost.com\/support\/?p=323"},"modified":"2022-09-05T19:06:19","modified_gmt":"2022-09-05T19:06:19","slug":"connecting-with-secure-shell","status":"publish","type":"post","link":"https:\/\/christianwebhost.com\/support\/web-hosting\/cpanel-help-guides\/connecting-with-secure-shell\/","title":{"rendered":"Connecting With Secure Shell (SSH)"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"top\">Overview<\/h2>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\">\n<ul class=\"wp-block-list\"><li><a href=\"#start\">Before you start<\/a><\/li><li><a href=\"#create\">Create Private\/Public Key Pair<\/a><\/li><li><a href=\"#upload\">Uploading your Public Key<\/a><\/li><li><a href=\"#connect\">Connect to Server<\/a><\/li><\/ul>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:66.66%\">\n<p>One method of uploading files to your cPanel server is by using an SSH (secure shell) connection. While SSH is a more powerful tool for file transfer, this method is for more advanced users. Here is how you can connect with SSH.<\/p>\n<\/div>\n<\/div>\n\n\n\n<hr class=\"wp-block-separator is-style-dots\" id=\"start\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Before you start<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">SSH Enabled<\/h3>\n\n\n\n<p>Before you can connect to our servers with SSH, you will first need to have it enabled for your account. To do this, you will need to contact support and request that SSH be enabled with a support ticket. You can find information on submitting a ticket <a href=\"https:\/\/christianwebhost.com\/support\/2021\/10\/25\/clientarea-supportticket\/\" data-type=\"post\" data-id=\"213\">here<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Shell client<\/h3>\n\n\n\n<p>You will also need a shell client in order to connect to the server.<\/p>\n\n\n\n<p>If you are using a Mac or Linux machine, both of these have a shell client built in. You may need to check with the respective support pages find how to use these apps.<\/p>\n\n\n\n<p>If you are using a Windows machine, you will need to either use the Windows PowerShell to connect, or download and install a shell client, such as Windows Terminal or <a href=\"https:\/\/www.chiark.greenend.org.uk\/~sgtatham\/putty\/\">PuTTY<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Private\/Public Key Pair<\/h3>\n\n\n\n<p>You will need to create a Private\/Public key pair from your shell and and upload the public key to your cPanel. We will have a guide for this <a href=\"#create\">below<\/a>.<\/p>\n\n\n\n<p><a href=\"#top\" data-type=\"internal\" data-id=\"#top\">Back to Top<\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator is-style-dots\" id=\"create\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Create Private\/Public Key Pair<\/h2>\n\n\n\n<p>The first step is to create a private\/public key pair in your shell. While this process may vary slightly depending on what shell you use, this guide should work on most.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Shell<\/h3>\n\n\n\n<ol class=\"wp-block-list\" type=\"1\"><li>Log into your shell of choice.<\/li><li>Change to your .ssh directory<ul><li><code>cd ~\/.ssh<\/code><\/li><li>You may need to create this folder if it does not exist.<\/li><li> <code>mkdir ~\/.ssh<\/code><\/li><\/ul><\/li><li>Run the ssh keygen command<ul><li> <code>ssh-keygen \u2013t rsa<\/code><\/li><\/ul><\/li><li>You should see the following<ul><li><code>Generating public\/private rsa key pair.<\/code><\/li><\/ul><\/li><\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Create the key and passphrase<\/h3>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"741\" height=\"402\" src=\"https:\/\/christianwebhost.com\/support\/wp-content\/uploads\/2021\/11\/cp-key.png\" alt=\"An example of creating a key set in shell.\" class=\"wp-image-852\"\/><\/figure>\n\n\n\n<ol class=\"wp-block-list\" type=\"1\"><li><code>Enter file in which to save the key (\/home\/user\/.ssh\/id_rsa):<\/code><ul><li>name the key (you can hit enter if you want this to be your default key, it will be named id_rsa)<\/li><\/ul><\/li><li><code>Enter passphrase (empty for no passphrase):<\/code><ul><li>enter a passphrase (you can hit enter if you do not wish to set a passphrase, but it is recommended to have one)<\/li><\/ul><\/li><li><code>Enter same passphrase again:<\/code><ul><li>confirm you passphrase <\/li><\/ul><\/li><li>You should now see the confirmation that the keys were set up<ul><li><code>Your identification has been saved in \/home\/sshguy\/.ssh\/id_rsa.<\/code><\/li><li><code>Your public key has been saved in \/home\/sshguy\/.ssh\/id_rsa.pub.<\/code><\/li><\/ul><\/li><li>&nbsp;To confirm the keys were created, you can list the .ssh folder.<ul><li><code>ls ~\/.ssh<\/code><\/li><li> You should see the private key (<code>key<\/code>) and the public key (<code>key.pub<\/code>)<\/li><\/ul><\/li><\/ol>\n\n\n\n<p><a href=\"#top\" data-type=\"internal\" data-id=\"#top\">Back to Top<\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator is-style-dots\" id=\"upload\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Uploading your Public Key<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Retrieve your public key<\/h3>\n\n\n\n<p>First, you will need to log into your shell to retrieve your key.<\/p>\n\n\n\n<ol class=\"wp-block-list\" type=\"1\"><li>Log into your shell.<\/li><li>Run the cat command on your public key to view it.<ul><li><code>cat ~\/.ssh\/key.pub<\/code>.<\/li><\/ul><\/li><li>Copy the public key to your clipboard.<\/li><\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"ssh-access\">Uploading your key to cPanel<\/h3>\n\n\n\n<p>Next, you want to log into your cPanel to upload the key there.<\/p>\n\n\n\n<p>If you do not know how to access your cPanel, you can find out <a href=\"https:\/\/christianwebhost.com\/support\/2021\/10\/26\/accessing-your-cpanel\/\" data-type=\"post\" data-id=\"288\">here<\/a>.<\/p>\n\n\n\n<p>Go to the <strong>Security <\/strong>section and click on the <strong>SSH Access <\/strong>app.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"996\" height=\"143\" src=\"https:\/\/christianwebhost.com\/support\/wp-content\/uploads\/2021\/11\/cp-security.png\" alt=\"The Security section in cPanel.\" class=\"wp-image-504\"\/><\/figure>\n\n\n\n<p>Click on <strong>Manage SSH Keys<\/strong> to get to the main <strong>SSH Access <\/strong>page. Here you will see any keys already uploaded you your cPanel, as well as options to <strong>Generate a New Key <\/strong>and <strong>Import Key<\/strong>. Click on <strong>Import Key<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1294\" height=\"694\" src=\"https:\/\/christianwebhost.com\/support\/wp-content\/uploads\/2021\/11\/cp-keys.png\" alt=\"The SSH Access homepage, where you can manage your keys.\" class=\"wp-image-854\"\/><\/figure>\n\n\n\n<p>You will now be at the Import SSH Key page.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"833\" height=\"810\" src=\"https:\/\/christianwebhost.com\/support\/wp-content\/uploads\/2021\/11\/cp-importkeys-1.png\" alt=\"The form used to import keys into cPanel.\" class=\"wp-image-856\"\/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<ul class=\"wp-block-list\"><li><strong>Choose a Name for this key<\/strong><ul><li>enter a name for this key (does not need to be the same as the name entered in shell).<\/li><\/ul><\/li><li><strong>Private Key<\/strong><ul><li>leave this blank (you <strong>Do Not <\/strong>want to copy your private key from your shell, it should remain private and secure at all times).<\/li><\/ul><\/li><li><strong>Passphrase<\/strong><ul><li>enter the password that you entered when creating the key pair, leave blank if you did not enter a passphrase.<\/li><\/ul><\/li><li><strong>Public key<\/strong><ul><li>paste your public key here .<\/li><\/ul><\/li><\/ul>\n<\/div>\n<\/div>\n\n\n\n<p>Click <strong>Import<\/strong> once finished to upload the public key.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Authorizing your key<\/h3>\n\n\n\n<p>Once uploaded, you need to authorize the key in cPanel.<\/p>\n\n\n\n<p>If you just uploaded the key, click <strong>Go Back<\/strong> at the bottom of the screen. Otherwise, get to the SSH Access page. You can find how <a href=\"#ssh-access\">above<\/a>. <\/p>\n\n\n\n<p>You should see your public keys listed.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"850\" height=\"168\" src=\"https:\/\/christianwebhost.com\/support\/wp-content\/uploads\/2021\/11\/cp-publickeys.png\" alt=\"The public keys section of cPanel, in the Manage Keys section.\" class=\"wp-image-858\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Click <strong>Manage<\/strong> to the right of the key you wish to authorize.<\/li><li>Click on <strong>Authorize<\/strong> .<\/li><li>Click on &#8220;<strong>Go Back<\/strong>&#8221; to return to the Key List.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Please note<\/strong>:<ul><li>You should always delete old keys when no longer needed.<\/li><\/ul><\/li><\/ul>\n\n\n\n<p><a href=\"#top\" data-type=\"internal\" data-id=\"#top\">Back to Top<\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator is-style-dots\" id=\"connect\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Connect to server<\/h2>\n\n\n\n<p>You can now connect to your cPanel server using the ssh command.<\/p>\n\n\n\n<p>ssh -i [path to key]\/[key name] [username]@[hostname]<\/p>\n\n\n\n<p>For example: <\/p>\n\n\n\n<p><code>ssh \u2013i ~\/.ssh\/keyname.pub <a href=\"mailto:user@domain.com\">user@domain.com<\/a> \u2013p1022<\/code><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Please note<\/strong>:<ul><li>For security reasons, our servers use port 1022 for ssh.<\/li><li>If you used the default key name (ida_rsa), you can omit the <code>-i ~\/.ssh\/keyname.pub<\/code> when connecting.<\/li><\/ul><\/li><\/ul>\n\n\n\n<p><a href=\"#top\" data-type=\"internal\" data-id=\"#top\">Back to Top<\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity is-style-dots\"\/>\n\n\n\n<p>If you have any further questions, please be sure to reach out to our support staff by using our chat service in your <a href=\"https:\/\/christianwebhost.com\/support\/2021\/10\/26\/accessing-your-client-area\/\" data-type=\"post\" data-id=\"249\">client area<\/a> or by submitting a <a href=\"https:\/\/christianwebhost.com\/support\/2021\/10\/25\/clientarea-supportticket\/\" data-type=\"URL\" data-id=\"https:\/\/christianwebhost.com\/support\/2021\/10\/25\/clientarea-supportticket\/\">ticket<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How do I connect to my cPanel server using SSH protocol?<\/p>\n","protected":false},"author":2,"featured_media":2334,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,14],"tags":[],"class_list":["post-323","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cpanel-help-guides","category-website-and-email-security"],"_links":{"self":[{"href":"https:\/\/christianwebhost.com\/support\/wp-json\/wp\/v2\/posts\/323","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/christianwebhost.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/christianwebhost.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/christianwebhost.com\/support\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/christianwebhost.com\/support\/wp-json\/wp\/v2\/comments?post=323"}],"version-history":[{"count":21,"href":"https:\/\/christianwebhost.com\/support\/wp-json\/wp\/v2\/posts\/323\/revisions"}],"predecessor-version":[{"id":2454,"href":"https:\/\/christianwebhost.com\/support\/wp-json\/wp\/v2\/posts\/323\/revisions\/2454"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/christianwebhost.com\/support\/wp-json\/wp\/v2\/media\/2334"}],"wp:attachment":[{"href":"https:\/\/christianwebhost.com\/support\/wp-json\/wp\/v2\/media?parent=323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/christianwebhost.com\/support\/wp-json\/wp\/v2\/categories?post=323"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/christianwebhost.com\/support\/wp-json\/wp\/v2\/tags?post=323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}