CLI SSH

Let's focus on the affordable solution to medium sized forums: VPS (Virtual Private Server) which means you have a hosting account with root access, a super-user allowing you full control over the server.

More information about SSH; http://en.wikipedia.org/wiki/Secure_Shell

A VPS usually has sshd (secure shell daemon) running, listening on a port for incoming ssh client connections. Most operating systems have ssh installed, for Windows you can use PuTTy, and on the Mac you can just open Terminal.app. The default port is 22, you can change this (which is recommended).

Let's talk about the syntax.

If you use the default port 22:
ssh -l user host
What also works:
ssh user@host

If you have a custom port:
ssh -l user host -p port

Let's break this down.

ssh is the command we're using. You tell the OS that you want to run the ssh client program called ssh
-l is the program parameter (lowercase L) which stands for login. You tell the ssh client to login using a certain login name.
user is the login name you want to use to login to the other machine.
host is the domain-, or IP address to which you want to connect to, such as the VPS host's dedicated IP for your account, or the domain name of your site.
-p is the parameter which stands for port. You tell it to use a specific port. Leaving it out is ok, it uses 22 as a default.
port is the port number you want to use, 22, or a custom one.

Imagine my site mrfloris.com, I might have the login floris (i use that for cpanel, and I use that for ftp) and we use a custom port, like 5500. My personal ssh command would be:
ssh -l floris mrfloris.com -p 5500

Once connected it might ask once to confirm a fingerprint, say yes. It will then ask for your password.
This is the password for the account on the VPS you're connecting to.

If everything went great, you are now remotely connected to the VPS and have a prompt in front of you, ready for linux commands.

When you're done, you can log out typing:
exit



 
Next Article