This One Tool Lets You Edit Your Website Remotely & Securely (and It’s Not FTP)
When you buy server space from DreamHost, you’re buying your own little piece of the web. That means you’ve got plenty of freedom when it comes to how you access and edit your files.
For example, you can use our web-based FTP client through the panel. You can connect through File Transfer Protocol (FTP). You can also use SSH, a protocol which allows you to connect to your DreamHost server space from your personal computer.
If the interface looks dated to you, that’s because it is. SSH has been around since 1995, but it is still the most secure text-based solution for accessing a remote server.
Without the clunkiness of FTP, SSH is a simple, minimalistic solution that allows you to send files back and forth without any of the overhead — it’s just you, SSH, and your text editor of choice. Even better, everything you send is encrypted so you don’t have to worry about your data being intercepted.
Whether you already build your own sites from scratch or you’re just learning how to now, SSH is a great way to get to know the code behind your web page. Here is how you can harness the power of SSH.
Related: 13 of the Best Security Plugins to Keep Your WordPress Site Safe
Enable SSH on Your Account
The first thing you need to do is enable SSH on your account. Go to your DreamHost dashboard, and on the left-hand side click on the ‘Users > Manage Users’ category.
Select the user to whom you want to give SSH access and click the Shell User radio button.
Notice this user is located “on chessman.” In this case, “chessman” is the name of the shared server. Even though chessman isn’t the name of my personal website, it’s how I will access the files that appear on it. Keep this name in mind because we’re going to use it later.
Next, leave the browser window and open up your command line interface. On a Mac, it’s a program called Terminal that comes with your operating system, which you can find by searching for it in Spotlight. (View the SSH wiki for details.) On a PC, it’s a free program called PuTTY that you’ll need to download first. Both of these programs do the same thing: they provide a text-based connection from your personal computer to your DreamHost server.
Once you have opened Terminal or installed PuTTY, you’re going to want to connect to the DreamHost server using SSH by telling it your username and servername, like so:
But that won’t work. Let’s say your username is “laurenrae” and your server is “chessman.” In that case, the command you’d want to input is:
The first time you connect, your computer will tell you it can’t establish the “authenticity of the host” because it’s remote, not something on your local computer. It will ask if you still want to connect. Type “yes.”
Next, you will be asked for your password. This is the password you chose for this Shell user when creating it on the ‘Users > Manage Users’ page in your panel. If you haven’t used the command line before, you may be surprised that your password shows up as blank space. That’s totally normal. Keep typing, and press enter at the end. You’re in!
Get Content Delivered Straight to Your Inbox
Subscribe to our blog and receive great content just like this delivered straight to your inbox.
SSH Stylesheet Usage
Now, I want to show you some examples from a friend’s DreamHost account. He is working on a joke site for his office and gave me SSH access so I could take a look.
In this case, my username is “banso” and our server is “thomas-lynch-jr.” (DreamHost loves to get creative with server names!) Here’s a screenshot of me logging in for the first time. You can see I accidentally wrote “y” when I meant yes, and the command line gave me a second chance.
My friend wanted me to take a look at the stylesheet of his page. I know that stylesheets always end with .css, the same way Microsoft Word files always end with .doc. So I need to look for that .css file extension. The first thing I do is type:
Which is short for “list directory contents.” It does so.
The name of the site is isitgreenday.com, which is the directory I want to check out. So I type:
The command “cd” is short for “change directory.” I want to leave the directory I am in and move into that one.
There it is! My friend’s stylesheet, titled aprilFools.css. I want to open the file, so I type:
This opens the file in Nano, which is a very simple text editor. It’s my personal preference out of the dozens of editors out there. I could also use a text editor called Vim, for example, by typing:
If I did that, it would open in the text editor Vim instead of Nano.Now I can scroll through this stylesheet, make changes, copy it to my desktop, and do anything else I want to do. When I’m done, I’ll press the Control + X keys at the same time to save my changes and exit the text editor. Next, I can open other files, like index.php, with a single prompt. I can collaborate with my friend on his website without leaving my computer desktop.
This is one of many, many uses for SSH. Don’t let its old-school look fool you; it’s still a secure, convenient, and surprisingly current way to edit your website, embraced by everyone from novice site builders to pros.
This tutorial should also include at least basic instructions for setting up sshfs, so people can use their favorite editor from their desktop. 🙂
Comments are closed.