{"id":725,"date":"2015-02-04T11:58:29","date_gmt":"2015-02-04T18:58:29","guid":{"rendered":"http:\/\/homepages.uc.edu\/~yaozo\/wordpress\/?p=725"},"modified":"2015-02-04T11:58:29","modified_gmt":"2015-02-04T18:58:29","slug":"how-to-connect-to-your-droplet-with-ss","status":"publish","type":"post","link":"https:\/\/zhuoyao.net\/index.php\/2015\/02\/04\/how-to-connect-to-your-droplet-with-ss\/","title":{"rendered":"How To Connect To Your Droplet with SS"},"content":{"rendered":"<h1 class=\"content-title\">How To Connect To Your Droplet with SSH<\/h1>\n<div class=\"tut-meta\"><\/div>\n<div class=\"tutorial-series-container collapsed\">\n<div class=\"tutorial-series-toggle\">This tutorial is part 1 of 3 in the series: <a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-connect-to-your-droplet-with-ssh#tutorial_series_33\" data-reveal=\"fast\">New CentOS 7 Server Checklist<\/a><\/div>\n<div class=\"tutorial-series-toggle\">This tutorial is part 1 of 3 in the series: <a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-connect-to-your-droplet-with-ssh#tutorial_series_32\" data-reveal=\"fast\">New Ubuntu 14.04 Server Checklist<\/a><\/div>\n<\/div>\n<div class=\"content-body tutorial-content\">\n<h3 id=\"introduction\">Introduction<\/h3>\n<p>If you have recently created a DigitalOcean Droplet, and you are new to working with Linux servers, you will need to learn how to use SSH to connect to and manage it. SSH, which stands for <em>Secure Shell<\/em>, is an encrypted network protocol that is used to for, among other things, remote server login and command execution. It is the standard method used for accessing and interacting with Linux servers.<\/p>\n<p>This quick tutorial will show you how to connect to your new Linux cloud server for the first time, by logging into it using an SSH client.<\/p>\n<div data-unique=\"prerequisites\"><\/div>\n<h2 id=\"prerequisites\">Prerequisites<\/h2>\n<p>The prerequisites section describes everything that you need know about to follow this tutorial. Of course, you will need to have created a new Droplet through <a href=\"https:\/\/cloud.digitalocean.com\/droplets\">the DigitalOcean Control Panel<\/a>.<\/p>\n<h3 id=\"server-information-and-login-credentials\">Server Information and Login Credentials<\/h3>\n<p>In order to connect to a remote Linux server via SSH, you must have following:<\/p>\n<ul>\n<li><strong>User name<\/strong>: The remote user to log in as. The default admin user, or <em>Superuser<\/em>, on most Linux servers is <code>root<\/code><\/li>\n<li><strong>Password and\/or SSH Key<\/strong>: The password that is used to authenticate the user that you are logging in as. If you added a public SSH key to your droplet when you created it, you must have the private SSH key of the key pair (and passphrase, if it has one)<\/li>\n<li><strong>Server IP address<\/strong>: This is the address that uniquely identifies your server on the Internet, and can be found in <a href=\"https:\/\/cloud.digitalocean.com\/droplets\">your DigitalOcean Droplets page<\/a><\/li>\n<\/ul>\n<p>If you did not add an SSH key to your Droplet when you created it, you should have received an email from DigitalOcean with the aforementioned connection information and credentials. The emailed password is temporary, and must be changed after the first login.<\/p>\n<h3 id=\"ssh-client-software\">SSH Client Software<\/h3>\n<p>There are a variety of SSH clients that you can use to connect to a Linux server. We will cover the following two:<\/p>\n<ul>\n<li><strong>OpenSSH<\/strong> <em>(Linux and Mac OS X)<\/em>: A collection of software that ships with most Unix-like operating systems that includes the <code>ssh<\/code> command<\/li>\n<li><strong>PuTTY<\/strong> <em>(Windows)<\/em>: A free SSH client that can run on Windows, and is available for download on <a href=\"http:\/\/www.chiark.greenend.org.uk\/~sgtatham\/putty\/download.html\">the PuTTY Download Page<\/a>. <code>putty.exe<\/code> is the SSH client, and <code>puttygen.exe<\/code> should also be downloaded if you want to use SSH keys.<\/li>\n<\/ul>\n<div data-unique=\"ssh-login-as-root\"><\/div>\n<h2 id=\"ssh-login-as-root\">SSH Login as Root<\/h2>\n<p>Now that you have all of the required information and software, you are now ready to log in to your server for the first time. Make sure to only follow the instructions that are relevant to your SSH client.<\/p>\n<h3 id=\"option-1:-openssh-(linux-and-mac-os-x)\">Option 1: OpenSSH (Linux and Mac OS X)<\/h3>\n<p>The OpenSSH <code>ssh<\/code> client is a command-line tool, so open a Terminal window to get started.<\/p>\n<h4 id=\"step-1\u2014initiate-the-connection\">Step 1\u2014Initiate the Connection<\/h4>\n<p>At the command prompt, enter the following command to attempt to connect to your server as the <code>root<\/code>user (subsitute the highlight word with your server&#8217;s IP address):<\/p>\n<pre><code langs=\"\">ssh root@<span class=\"highlight\">SERVER_IP_ADDRESS<\/span>\n<\/code><\/pre>\n<p>For example, if the server IP address was <code>123.234.123.234<\/code>, the command would look like this: <code>ssh root@123.234.123.234<\/code>.<\/p>\n<p>The first time you attempt to connect to your server, you will likely see a warning that looks like this:<\/p>\n<pre><code langs=\"\">The authenticity of host '123.123.123.123 (123.123.123.123)' can't be established.\nECDSA key fingerprint is\n79:95:46:1a:ab:37:11:8e:86:54:36:38:bb:3c:fa:c0.\nAre you sure you want to continue connecting (yes\/no)?\n<\/code><\/pre>\n<p>Go ahead and type <code>yes<\/code> to continue to connect. Here, your computer is telling you that the remote server is not recognized. Since this is your first time connecting, this is completely expected. Skip to step 2, Authentication.<\/p>\n<p>If you happened to destroy a droplet directly prior to creating the one that you are connecting to, you may see a warning like this:<\/p>\n<pre><code langs=\"\">@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\nIT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!\nSomeone could be eavesdropping on you right now (man-in-the-middle attack)!\nIt is also possible that a host key has just been changed.\n...\n<\/code><\/pre>\n<p>If this is the case, your new droplet probably has the same IP address as the old, destroyed droplet, but a different host SSH key. This is fine, and you can remove the warning, by deleting the old droplet&#8217;s host key from your system, by running this command:<\/p>\n<pre><code langs=\"\">ssh-keygen -R <span class=\"highlight\">SERVER_IP_ADDRESS<\/span>\n<\/code><\/pre>\n<p>Now try connecting to your server again.<\/p>\n<h4 id=\"step-2\u2014authenticate\">Step 2\u2014Authenticate<\/h4>\n<p>The authentication step involves providing a password and\/or a private SSH key to prove that you are authorized to log in as <code>root<\/code>.<\/p>\n<p>If you <strong>added an SSH key<\/strong> to your Droplet, and you have the private key installed on your computer, OpenSSH will attempt to use the key to authenticate to the <code>root<\/code> account. If you used a key with a passphrase, you will need to provide the passphrase to complete the login process. At this point, if you are unable to log in, you may need to start your <code>ssh-agent<\/code> and add your SSH keys to it with the following command (assuming your key is called &#8220;id_rsa&#8221;), then go back to <em>Step 1<\/em>:<\/p>\n<pre><code langs=\"\">eval `ssh-agent -s`\nssh-add ~\/.ssh\/<span class=\"highlight\">id_rsa<\/span>\n<\/code><\/pre>\n<p>If you <strong>did not add an SSH key<\/strong> to your Droplet, you will be prompted for the temporary password, and you will also be required to change it. Follow these steps to complete the login process:<\/p>\n<ol>\n<li>Copy the temporary password from the email, and paste it into the password prompt<\/li>\n<li>At the <code>(current) UNIX password<\/code> prompt, paste in the temporary password again<\/li>\n<li>At the <code>Enter new UNIX password<\/code> prompt, enter a strong password<\/li>\n<li>At the <code>Retype new UNIX password<\/code> prompt, enter the same strong password that you just entered<\/li>\n<\/ol>\n<p>Don&#8217;t forget the new password that you set.<\/p>\n<p>You&#8217;re now logged in! Skip to the <em><a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-connect-to-your-droplet-with-ssh#where-to-go-from-here?\">Where To Go From Here?<\/a><\/em> section of this tutorial to read about what your next steps with your server should be.<\/p>\n<h3 id=\"option-2:-putty-(windows)\">Option 2: PuTTY (Windows)<\/h3>\n<p>Run <code>putty.exe<\/code> by double-clicking on it, which will start the program and take you to the configuration screen.<\/p>\n<p><strong>Note:<\/strong> These steps do not cover using SSH keys with PuTTY. If you need to use SSH keys with PuTTY, use PuTTYgen to generate and load keys.<\/p>\n<h4 id=\"step-1\u2014configure-the-connection\">Step 1\u2014Configure the Connection<\/h4>\n<p>To properly configure the the SSH connection in putty, ensure that the following settings are set:<\/p>\n<ul>\n<li><strong>Host Name (or IP address)<\/strong>: Enter your server&#8217;s IP address here<\/li>\n<li><strong>Port<\/strong>: 22 (default)<\/li>\n<li><strong>Connection Type<\/strong>: SSH (default)<\/li>\n<\/ul>\n<p>You may now name and save this particular connection for future use by typing a name in the &#8220;Saved Sessions&#8221; field, and clicking &#8220;save&#8221;.<\/p>\n<h4 id=\"step-2\u2014initiate-the-connection\">Step 2\u2014Initiate the Connection<\/h4>\n<p>To initiate the connection, double-click on the session name, and accept the security alert (this will only appear the first time you connect to a server).<\/p>\n<h4 id=\"step-3\u2014authenticate\">Step 3\u2014Authenticate<\/h4>\n<p>The authentication step involves providing the login credentials, the user name and temporary password, to connect to the server. Following the initial connection, you will be required to change the password.<\/p>\n<p>Follow these steps to complete the login process:<\/p>\n<ol>\n<li>At the <code>login as<\/code> prompt, enter <code>root<\/code><\/li>\n<li>At the <code>Password prompt<\/code>, enter the password that was emailed to you (copy and paste it)<\/li>\n<li>At the <code>(current) UNIX password<\/code> prompt, paste in the temporary password again<\/li>\n<li>At the <code>Enter new UNIX password<\/code> prompt, enter a strong password<\/li>\n<li>At the <code>Retype new UNIX password<\/code> prompt, enter the same strong password that you just entered<\/li>\n<\/ol>\n<p>Don&#8217;t forget the new password that you set.<\/p>\n<div data-unique=\"where-to-go-from-here?\"><\/div>\n<h2 id=\"where-to-go-from-here?\">Where To Go From Here?<\/h2>\n<p>Congratulations! You are logged in to your server over SSH!<\/p>\n<p>The next steps are to set up some basic security measures to protect your server from being compromised. These steps are covered in these distribution-specific tutorials:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/initial-server-setup-with-ubuntu-14-04\">Initial Server Setup with Ubuntu 14.04<\/a><\/li>\n<li><a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/initial-server-setup-with-centos-7\">Initial Server Setup with CentOS 7<\/a><\/li>\n<\/ul>\n<p><span class=\"meta-section tags\"><span class=\"meta-label\">Tagged In: <\/span><span class=\"meta-value\"><a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/getting-started?primary_filter=tutorials\">Getting Started<\/a>, <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/linux-basics?primary_filter=tutorials\">Linux Basics<\/a>, <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/digitalocean?primary_filter=tutorials\">DigitalOcean<\/a><\/span><\/span><\/p>\n<div class=\"row boxes\">\n<div class=\"half\">\n<div class=\"box author\"><a href=\"https:\/\/www.digitalocean.com\/community\/users\/manicas\"><img loading=\"lazy\" decoding=\"async\" class=\"avatar avatar-large\" src=\"https:\/\/secure.gravatar.com\/avatar\/695da9dd73504edfc622c9be380cb3cb?secure=true&amp;d=identicon\" alt=\"manicas\" width=\"80\" height=\"80\" \/><\/a><\/p>\n<div class=\"info\">\n<div class=\"label\">Written By:<\/div>\n<div class=\"name\"><a href=\"https:\/\/www.digitalocean.com\/community\/users\/manicas\">Mitchell Anicas<\/a><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"half\">\n<div class=\"box hearting secondary-tutorial-upvote \">\n<div class=\"heart\"><\/div>\n<div class=\"info\"><span class=\"empty\">Do you find this post helpful?<br \/>\nShow the author by Hearting it!<\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"clearfix\"><\/div>\n<\/div>\n<div class=\"clear\"><\/div>\n<div class=\"clear\"><\/div>\n<\/div>\n<div class=\"tutorial-series-container \">\n<h2>Tutorial Series<\/h2>\n<div id=\"tutorial_series_33\" class=\"tutorial-series \">\n<h3 class=\"series-title\"><a href=\"https:\/\/www.digitalocean.com\/community\/tutorial_series\/new-centos-7-server-checklist\">New CentOS 7 Server Checklist<\/a><\/h3>\n<div class=\"description\">When creating a new CentOS 7 server, there are some basic tasks that you should take to ensure that your server is secure and configured properly. The tutorial series covers connecting to your server and general security best practices, and provides links to articles that will help you start running your own web server or application.<\/div>\n<ol class=\"tutorial-series-list\">\n<li class=\"active\">\n<h2><a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-connect-to-your-droplet-with-ssh\">How To Connect To Your Droplet with SSH<\/a><\/h2>\n<div class=\"meta\"><span class=\"author\">By <a href=\"https:\/\/www.digitalocean.com\/community\/users\/manicas\">Mitchell Anicas<\/a><\/span> <span class=\"tag\">tagged in <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/getting-started?primary_filter=tutorials\">Getting Started<\/a>, <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/linux-basics?primary_filter=tutorials\">Linux Basics<\/a>, <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/digitalocean?primary_filter=tutorials\">DigitalOcean<\/a><\/span><\/div>\n<div class=\"arrow-left\"><\/div>\n<\/li>\n<li class=\"\">\n<h2><a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/initial-server-setup-with-centos-7\">Initial Server Setup with CentOS 7<\/a><\/h2>\n<div class=\"meta\"><span class=\"author\">By <a href=\"https:\/\/www.digitalocean.com\/community\/users\/manicas\">Mitchell Anicas<\/a><\/span> <span class=\"tag\">tagged in <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/security?primary_filter=tutorials\">Security<\/a>, <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/linux-basics?primary_filter=tutorials\">Linux Basics<\/a>, <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/centos?primary_filter=tutorials\">CentOS<\/a><\/span><\/div>\n<div class=\"arrow-left\"><\/div>\n<\/li>\n<li class=\"\">\n<h2><a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/additional-recommended-steps-for-new-centos-7-servers\">Additional Recommended Steps for New CentOS 7 Servers<\/a><\/h2>\n<div class=\"meta\"><span class=\"author\">By <a href=\"https:\/\/www.digitalocean.com\/community\/users\/jellingwood\">Justin Ellingwood<\/a><\/span> <span class=\"tag\">tagged in <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/security?primary_filter=tutorials\">Security<\/a>, <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/centos?primary_filter=tutorials\">CentOS<\/a>, <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/system-tools?primary_filter=tutorials\">System Tools<\/a><\/span><\/div>\n<div class=\"arrow-left\"><\/div>\n<\/li>\n<\/ol>\n<\/div>\n<div id=\"tutorial_series_32\" class=\"tutorial-series \">\n<h3 class=\"series-title\"><a href=\"https:\/\/www.digitalocean.com\/community\/tutorial_series\/new-ubuntu-14-04-server-checklist\">New Ubuntu 14.04 Server Checklist<\/a><\/h3>\n<div class=\"description\">When creating a new Ubuntu 14.04 server, there are some basic tasks that you should take to ensure that your server is secure and configured properly. The tutorial series covers connecting to your server and general security best practices, and provides links to articles that will help you start running your own web server or application.<\/div>\n<ol class=\"tutorial-series-list\">\n<li class=\"active\">\n<h2><a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-connect-to-your-droplet-with-ssh\">How To Connect To Your Droplet with SSH<\/a><\/h2>\n<div class=\"meta\"><span class=\"author\">By <a href=\"https:\/\/www.digitalocean.com\/community\/users\/manicas\">Mitchell Anicas<\/a><\/span> <span class=\"tag\">tagged in <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/getting-started?primary_filter=tutorials\">Getting Started<\/a>, <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/linux-basics?primary_filter=tutorials\">Linux Basics<\/a>, <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/digitalocean?primary_filter=tutorials\">DigitalOcean<\/a><\/span><\/div>\n<div class=\"arrow-left\"><\/div>\n<\/li>\n<li class=\"\">\n<h2><a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/initial-server-setup-with-ubuntu-14-04\">Initial Server Setup with Ubuntu 14.04<\/a><\/h2>\n<div class=\"meta\"><span class=\"author\">By <a href=\"https:\/\/www.digitalocean.com\/community\/users\/jellingwood\">Justin Ellingwood<\/a><\/span> <span class=\"tag\">tagged in <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/getting-started?primary_filter=tutorials\">Getting Started<\/a>, <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/security?primary_filter=tutorials\">Security<\/a>, <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/linux-basics?primary_filter=tutorials\">Linux Basics<\/a>, <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/ubuntu?primary_filter=tutorials\">Ubuntu<\/a>, <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/faq?primary_filter=tutorials\">FAQ<\/a><\/span><\/div>\n<div class=\"arrow-left\"><\/div>\n<\/li>\n<li class=\"\">\n<h2><a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/additional-recommended-steps-for-new-ubuntu-14-04-servers\">Additional Recommended Steps for New Ubuntu 14.04 Servers<\/a><\/h2>\n<div class=\"meta\"><span class=\"author\">By <a href=\"https:\/\/www.digitalocean.com\/community\/users\/jellingwood\">Justin Ellingwood<\/a><\/span> <span class=\"tag\">tagged in <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/security?primary_filter=tutorials\">Security<\/a>, <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/ubuntu?primary_filter=tutorials\">Ubuntu<\/a>, <a class=\"\" href=\"https:\/\/www.digitalocean.com\/community\/tags\/system-tools?primary_filter=tutorials\">System Tools<\/a><\/span><\/div>\n<div class=\"arrow-left\"><\/div>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>How To Connect To Your Droplet with SSH This tutorial is part 1 of 3 in the series: New CentOS 7 Server Checklist This tutorial&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-725","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts\/725","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/comments?post=725"}],"version-history":[{"count":0,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts\/725\/revisions"}],"wp:attachment":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/media?parent=725"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/categories?post=725"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/tags?post=725"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}