Saturday, March 7, 2015

Linux Mint: Install and configure OpenSSH

Objective


It should be possible to log-into my new desktop computer from my laptop via ssh.

Motivation


Sometimes I want to run a script or program on my more powerful desktop computer, also while I am just sitting in front of my laptop. Furthermore I want to be able to configure my desktop computer from remote. To achive this I need to install and configure openssh inclusive X11 forwarding.

Prerequisites


  • Linux Mint 17.1 Rebecca
  • A second computer or laptop with a ssh-client e.g. putty installed

Solution


Install the OpenSSH packages


Open a terminal. Download and install the openssh server and client package:

$> sudo apt-get install openssh-server openssh-client

you'll see some output like this:

Reading package lists... Done
Building dependency tree
Reading state information... Done
openssh-client is already the newest version.
Suggested packages:
rssh molly-guard monkeysphere
Recommended packages:
ncurses-term ssh-import-id
The following NEW packages will be installed:
openssh-server openssh-sftp-server
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 354 kB of archives.
After this operation, 1.072 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ trusty-updates/main openssh-sftp-server amd64 1:6.6p1-2ubuntu2 [34,1 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ trusty-updates/main openssh-server amd64 1:6.6p1-2ubuntu2 [319 kB]
Fetched 354 kB in 0s (781 kB/s)
Preconfiguring packages ...
Selecting previously unselected package openssh-sftp-server.
(Reading database ... 159066 files and directories currently installed.)
Preparing to unpack .../openssh-sftp-server_1%3a6.6p1-2ubuntu2_amd64.deb ...
Unpacking openssh-sftp-server (1:6.6p1-2ubuntu2) ...
Selecting previously unselected package openssh-server.
Preparing to unpack .../openssh-server_1%3a6.6p1-2ubuntu2_amd64.deb ...
Unpacking openssh-server (1:6.6p1-2ubuntu2) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for ureadahead (0.100.0-16) ...
ureadahead will be reprofiled on next reboot
Processing triggers for ufw (0.34~rc-0ubuntu2) ...
Setting up openssh-sftp-server (1:6.6p1-2ubuntu2) ...
Setting up openssh-server (1:6.6p1-2ubuntu2) ...
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Creating SSH2 ECDSA key; this may take some time ...
Creating SSH2 ED25519 key; this may take some time ...
ssh start/running, process 3190
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for ufw (0.34~rc-0ubuntu2) ...

Configure OpenSSH


The default configuration for OpenSSh on Linux Mint Rebecca located at /etc/ssh/sshd_config should already work fine without any further adjustment. The only limitation is that yout cannot log in as root by default.

If you want to allow remote login as root, open a shell and edit /etc/ssh/sshd_config:
$> gksu gedit /etc/ssh/sshd_config

Now change the following line to:

PermitRootLogin yes

Now you are done and can do a test log-in.

No comments:

Post a Comment