SSH

From DreamHost
(Redirected from Ssh)
Jump to: navigation, search

Overview

SSH, or Secure Shell, is a secure alternative to telnet. With SSH, you are able to securely copy/edit files, access SVN, cron jobs, and other DreamHost services via a standard Unix command line also known as shell. All SSH traffic travels over a secured connection rather than plain text. Because of this, the connection is encrypted and secure. DreamHost currently uses OpenSSH software on the server end.

Dh-kb-note-icon.fw.png Note: Before being able to log into your server via SSH, you must update your user to a SHELL user in the panel. This process is detailed in the Enabling Shell Access article.

Enabling Shell Access


Logging into your server

When you're ready to log into your server via SSH, you'll need to know your hostname. This can be one of four names:

  1. example.com
    You can use this if you're logging into a specific domain. Just change 'example.com' to your actual domain name
    Dh-kb-note-icon.fw.png Note: The following three examples use your server name. View the 'Finding your server name' article for details on how to obtain the correct name.


  2. server.dreamhost.com
    'server' is the name of your Shared server
  3. ps123456.dreamhostps.com
    'ps123456' is the name of your VPS server
  4. ds123456.dreamservers.com
    'ds123456' is the name of your Dedicated server
  5. wp123456.dreamhostps.com
    'wp123456' is the name of your DreamPress server.
Dh-kb-important-icon.fw.png Important: This article uses server.dreamhost.com as a general example. Make sure to use the correct server name for your particular site or server.


Run the following command in your terminal to log in:

ssh username@server.dreamhost.com  

-or-

ssh username@example.com

Be sure to change "example.com" to your actual domain or server.dreamhost.com to the server to which you're attempting to connect.

SSH client software

Windows is the only commonly-used operating system that does not include a native SSH client. Windows users need to download SSH software separately (see below). Mac OS X and Unix/Linux users can run the SSH client from any terminal application.

Below are instructions on how to use SSH depending on the operating system or device you are using to connect.

See also: Comparison of SSH clients on Wikipedia

Mac OS X

The simplest way to open terminal on OSX is to use the spotlight search. Press COMMAND (⌘) + SPACEBAR and then type the word terminal:

01 SSH MacOSX Spotlight terminal.fw.png

After you select that, the terminal screen opens:

SSH MacOSX OpenTerminal.fw.png

In terminal, enter your login command which looks like this:

ssh username@server.dreamhost.com

For example, here is a screenshot of a DreamHost user named mywikiuser connecting to a server named charles-pickney:

02 SSH MacOSX terminal connected.fw.png

Unix/Linux

Most distributions of Unix/Linux come with the OpenSSH package. Any terminal application (xterm, Konsole, and so on) can be used to initiate a secure shell. To log into your web server using SSH in a Unix/Linux environment, type the following into your shell terminal:

ssh username@example.com

Be sure to change ‘username’ to your SHELL user in the panel and change ‘example.com’ to the domain you’re attempting to connect.

For logging in to a VPS, you would use the following format:

ssh username@psxxxxxx.dreamhostps.com

For example, let’s say your VPS is named ps12345. Your login would then be as follows:

ssh username@ps12345@dreamhostps.com

Windows

Every windows SSH client has its own way to be installed and launched, but once you've set it up, there is no difference in further operations. However, each client is suited to specific (or general needs). So, you may wish to try more than one to see what works best for you. Here are a few options:

PuTTY
This is a free and very popular client for Windows users.
WinSCP
This is a free and popular client as well. However it’s not a fully functioning client compared to PuTTY.
CWRSYNC
SmartFTP
SecureCRT
ZOC Terminal
Also available for OS X.

Chrome

Secure Shell is a terminal emulator and stand-alone ssh client for the Chrome web browser. As of January 2015, it's still in beta release with known bugs.

iPhone

An excellent paid SSH app for both iPhone and iPad is Prompt2, by Panic. However, if you don’t want to pay for the premium version, a free app is available through Serverauditor by Cystanix for the iPhone and iPad. This SSH terminal is highly rated by other users and is free to download as well.

You can read more about Serverauditor here:

When you open Serverauditor, the ‘Activity’ page opens which is blank.

    01 SSH iPHone.fw.png
  1. Tap the cloud icon in the top left corner:
    After you tap the cloud icon, a side panel opens which shows various options:
    02 SSH iPHone.fw.png
  2. To connect via SSH, tap the Quick Connect option at the top.
    The Quick Connect screen opens which prompts you for SSH settings:
    03 SSH iPHone.fw.png
  3. Enter the following:
    • username: Enter the username in this field.
    • hostname: Enter the host name or server to connect to here.
    • port setting: Since you’re connecting via SSH, the port setting should be set to 22.
    • password (optional): Enter the user’s password here. This is actually not an optional field like it states.
  4. After filling in the details for your user’s login details, tap the Connect button to connect to the host server.
    After you successfully log in, your user's home directory opens where you can manage the domain's site files:
    04 SSH iPHone.fw.png

You can use standard Linux commands to navigate through your user with this application.

Android

ConnectBot is an SSH application available for free on the Android Market. You can use it to access SSH, Telnet, and local protocols.

Passwordless login

Once you set up a shell user, you must enter your password each time when logging into the server. If you’d like to avoid entering your password each time, you can set up Passwordless Login. This way, you'll be able to automatically login each time immediately without needing to enter your password.

View the following article for instructions on how to enable this in different operating systems:

Troubleshooting

Private key doesn't work

The most common case for a private key not working is that the permissions are set incorrectly on your .ssh directory. In particular, the .ssh directory, as well as your authorized_keys file, must both be set to only be writable by your user. If you're having issues, please try running the following:

chmod 700 $HOME/.ssh
chmod 600 $HOME/.ssh/authorized_keys

Directory/filenames which contain non-English/Asian characters show up as ?????? or are corrupt

If you are having problems with your filenames or content not showing up correctly, you can add the following to your .bash_profile file to enable UTF support:

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export G_FILENAME_ENCODING=UTF-8\

UTF-8 is most likely enabled already. You can check in your terminal by entering the command ‘locale’:


[horsetail]$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE=C
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

You can see the first line is LANG=en_US.UTF-8. If for some reason this still doesn’t work, it’s most likely the terminal client you’re using. For instructions on how to configure this in PuTTY please visit the following article:

Server unexpectedly closed network connection

If you get this error when attempting to SSH, this can mean your IP has been blocked. Contact support to see if your IP is blocked. If so, support is able to whitelist it. If you don't know your IP, visit whatismyipaddress.com.

[User] is not in the sudoers group

DreamHost does not allow regular shell users sudo access on shared servers for security purposes. While many tasks can be accomplished without the use of sudo, if you do need sudo access, you must upgrade to a Dedicated server and create an admin user.

Idle connections are getting dropped

DreamHost and other ISPs may kill ssh connections that remain idle longer than a certain number of minutes. The fix is simple in Linux or OSX. All you need to do is set up keep-alive by editing the /etc/ssh/ssh_config or ~/.ssh/config file on your computer. In that file, add the following:

  Host *
      ServerAliveInterval 15
      ServerAliveCountMax 4

Now, the ssh client asks the server for a sign of life every 15 seconds, thus keeping the connection open.

For instructions on how to configure this setting in PuTTY, please visit the following article:

Killed

Running processes via SSH that consume large quantities of memory and/or processor power may lead them to be "Killed" – see the following article for further information:

See also