Setup a Personal Home SSH Server

ssh logo
To download these tutorials for OFFLINE viewing or for archive purposes please (Click here to download)
(Clicking the “.zip” will open the Archive, un-zip the .mht files then use one of the plugins below to view them)

You can open .mht WebArchive files directly inside FireFox Or Google Chrome by installing a plugin


There is loads of ways now to setup a SSH Server on a windows based PC. Many of them now include 1 click installers with GUI Solutions Every day more and more programs get released onto the web making it super easy for users to setup with advanced sweet GUI’s to boot.

Simple is better i agree, But wouldn’t you like to know how to do this manually so you can have more of an understanding how things work? ONE Click solutions are amazing tools really are great, But it takes away the fun of building a server yourself.

It’s simple to set up an SSH server right on your Windows PC with Cygwin (and even simpler on your Mac).

Once your personal SSH server is up and running, you can connect to your home computer securely from anywhere on the internet, up and download files and perform all the command line tasks your heart desires. And with new GUI tools made available daily from other software authors this makes remotely administrating your home PC so secure unlike VNC.

Why SSH?

Unlike a home web server, SSH is read/write, meaning you can get and put files on a server with it.
Unlike a home FTP server, SSH is secure. All the transactions are encrypted and cannot be sniffed.
Unlike a VNC server, SSH (alone) doesn’t let you drive your computer remotely, and it is also secure/encrypted

Install and configure OpenSSH

We’re going to use the free Unix emulator Cygwin to get the Open SSH suite installed on your Windows machine.
Run Cygwin’s setup.exe and from the package list, check offopenssh,” which appears in theNet group, as shown.

cygwin

Complete the Cygwin setup like any other normal installer and restart if necessary.

Now onto setting up the Server Command Line Style!

launch a Cygwin command line window and type the following ssh-host-config

When the script asks you about “privilege separation” answer yes.
When the script asks to “create local user sshd” answer yes.
When the script asks to “install sshd as a service” answer yes.
When the script stops and asks you for “CYGWIN=” answer ntsec tty

what is ntsec tty? never heard if it.. tty? talk to you later? well that’s the first thing that comes to mind

CYGWIN=ntsec tty, that is a Cygwin-specific variable, not just OpenSSH. In this case,
you are telling any programs that use Cygwin that you want to use Windows NT security (ntsec)
and to treat your command window as a teletype terminal (tty). On with the show people!



Run your SSH server

Now it’s time to get your SSH server up and running. Since we’re on Windows we’ll start it as a service.
(Remember this is running the Server NOT Logging into the Server as a user etc)

  • It will use your Windows login names and passwords to authenticate users.
    (Make sure all your PC login’s have strong passwords associated with them!)

At the Cygwin prompt, type: net start sshd

You should get:

The CYGWIN sshd service is starting.
The CYGWIN sshd service was started successfully.


Cygwin SSH server (Service Mode)

Because we are running Cygwin SSH Server as a windows service, You can now start and stop the Cygwin SSH server in the Services panel. In Control Panel, Administrative Tasks, choose Services. Right-click on the “CYGWIN sshd” item to start, stop, disable or edit other properties of the service, as shown in the diagram below.

ssh services

Remember to Open Port 22

Now that your server’s running, you have to open a port on your firewall to let clients connect to it Remember, SSH runs on port 22, so that’s the port you want to forward in your router. For folks running the regular Windows Firewall, add the SSH port to your list of exceptions. In Control Panel, click on Windows Firewall, and on the Exceptions tab, click “Add Port” and enter ssh and port 22, as shown in the diagram below.

add a port

Now you’re ready to log in.

Connect to your server!

There are several ways to connect to your new SSH server. You just need the server’s IP address (internal for local networks, external from out on the internet, or perhaps your dynamic DNS name.) the easiest way is using PuTTY to connect but lets keep things barebones for now since this is about learning.

From the command line on the remote machine type in ssh ipaddress -l username

(That’s a dash lower-case L, not 1 before username.) Once you’re logged in, you’re sitting at the command line of the remote machine with freedom to do whatever you want at the prompt. Still hating command line i guess? Well here’s a great program to admin your new SSH Server!

For a graphical user interface that transfers files, download and install the excellent, free WinSCP.
Create a new connection to your server, as shown (replacelocalhostwith your server’s IP address.)

winscp_login

Once you connect, browse the server’s files, download and upload the documents you need.
Finally, you can just use a regular FTP client that supports SFTP, or secure FTP.

IF all this is too much for you, And you want a really simple GUI solution then there
is many different ways to run/create a home SSH Server. here’s about 30 of them!