How to ssh into a server for the first time

“SSH into server X”, says someone to which I reply, “what the hell is ssh?”

For some reason, or another you need to access a remote server, and this scares you because you have never used the command line before. The concept of using a computer that doesn’t have a screen confuses. Not to worry ssh-ing into a server is extremely easy! I’ll add future posts for what to do when you actually get there but let’s start with baby steps.

Mac vs Windows (vs Linux)

Mac users have it pretty easy. Every machine comes with a “Teriminal” application in the “Utilities” directory that will be your go to app for using command line tools. If you are on a windows machine good luck. There isn’t really a user-friendly command line environment worth running that comes with the machine. Your best option is to download cygwin (a command line tool that mimic nix like shells), and make sure you install ssh (and why not scp while you’re at it) . Once you’ve done that the process is pretty much the same, so this tutorial could work for you. If you use a linux machine, you probably have no need for this tutorial, but for reference you can easily open up a shell and run the same commands.

Remote server access

Step one, find the address of the server you are trying to access and determine if you have login priveledges. Presumably there is a remote server somewhere that you need to access, and this remote server has an address. If you are working on the network you can probably access it through the name alone but if you are off the local network you may require an extended address (or some servers do not allow access to non-local users). For example let’s say you want to access one of Stanford’s clusters for students called “corn”. If you are on campus you can typically just use the name corn, while users off-campus need to use the address And in terms of access, last time I checked it’s available off-campus but you need to have an account to log in.

Opening up a terminal

Step two, open up a terminal applicaiton. I’ll stick with the mac in this example but for other systems just do corresponding steps. In your Applications folder there is a subfolder called Utilities, and inside that folder there is a little application called Terminal. If you plan on doing any kind of computation in your future this little application will be your best friend, and I recommend adding it to your dock. Go ahead and open the Terminal application. A plain square box will appear. At the top there will be a little line listing your last login time/date and below that you’ll see some text follwed by a dollar sign ($) and a gray box.


Finally, to connect to a remote server simply type the following command:

ssh corn

or if you are out of the network then:


or if you need to use a username and password combination then:


where you would replace “user” with your user name. Next you’ll see some text show up and if it’s your first time logging into the server then you’ll be prompted for a response (yes/no), type yes and press return. Then if the server you’re attempting to log into requires a password you’ll be asked for a password. Type in your password (note: text won’t show up as you type), and then press return. Some text will show up which you can typically ignore and then you’ll be logged in to the remote server.

Final remarks

Now that you’re logged in the world is your oyster! But I’m guessing it’ll take a bit of learning before you become a linux ninja. I recommending googling, reading tutorials, and talking to people to find out how to solve any problem that may come up. One last little tip for the terminal, if you ever need help on a command type:

 man [command]

and information on that command will show up. It’s typically a bit dense but extremely informational. Good luck!

Published: March 21 2014

blog comments powered by Disqus