My media server runs headless, so I need a way to log into it from other machines for remote administration. Telnet is installed by default on Ubuntu Server, but it does not offer a secure, encrypted channel to the server, even when transferring the password. SSH, on the other hand, offers all the features of Telnet, and a lot more—including a file transfer protocol, SFTP—all within the secure, encrypted channel we want to use to connect to our server.

The most appropriate way to remotely manage an Ubuntu Server is via Secure Shell, or SSH. SSH allows you to make a secure connection to your server, which you can use for many different purposes. Most of the time, you use SSH to log in to a shell for remote administration; think of it as a secure Telnet. You can also use it to transfer files via SFTP, or as a tunnel for rsync. You can also use it to forward or tunnel ports, or to set up a simple VPN. On Ubuntu, OpenSSH is the most common Secure Shell server. The instructions below apply to Ubuntu Server 10.04, Lucid Lynx.

Installing OpenSSH

Ubuntu Server’s installer offers you the option of installing OpenSSH. If you did not elect to do so, it is simple to invoke the exact same install process from the command line. It happens that apt-get isn’t the command you use here. Instead, you use tasksel, which is meant to install groups of software packages based on tasks (such as file sharing, in this case).

$ tasksel install openssh-server

Configuration

My needs are simple: I merely want to connect to my server through the standard port (22), log in via my user name and password, and use the Bash shell or SFTP. I don’t need to use a public key-based authentication, or run the server on a nonstandard port, because it is not accessible from outside my home network. Fortunately for me, the default configuration suffices; I have never had to touch the OpenSSH configuration files.

Logging In via SSH

Logging in from other computers on your network is pretty simple. Macs and many Linux and Unix-like distributions include an SSH client by default, so you can open a terminal and issue a SSH command, as follows.

$ ssh 192.168.1.3

SSH clients assume that your account name on the remote machine is the same as it is on the local client. If the account name is different, you simply have to specify it in the SSH command.

$ ssh account@servername

On Windows machines, you have to install an SSH client, such as PuTTY, to SSH into your server.

Transferring Files via SFTP

OpenSSH includes modules for file sharing via SFTP, or SCP, which is an older protocol. The easiest way to use SFTP is via a SFTP client, which will provide a nice GUI to transfer files, just like through FTP, but through a secure channel. Typical SFTP clients include WinSCP (Windows), CyberDuck (Mac), and FileZilla (all platforms). You simply have to configure the client to log into your SSH server via port 22, your username, and your password.

Important: Uninstall Telnet

Once you have set up OpenSSH for remote administration, I strongly urge you to uninstall Telnet. Telnet does not encrypt any data between the remote computer and the server, so your password and other information could be intercepted over the network. Even if you think your network is secure, there’s little overhead involved with running OpenSSH instead of Telnet, so there is not much benefit for keeping Telnet installed.

$ sudo apt-get remove telnetd