User Tools

Site Tools

Enable SSH Access with a key

1. Create public/private key pair

  $ ssh-keygen -t rsa -b 4096 -C ""

2. Copy the contents of the file to the clipboard

  $ pbcopy < ~/.ssh/

3. Create config file

  $ cd ~/.ssh
  $ cat >> config
  Host turris
  Port 22
  User root
  IdentityFile ~/.ssh/id_rsa

If remote-editing (using Sublime Text, TextMate, or VS Code) is desired, modify config to resemble:

    IdentityFile ~/.ssh/id_rsa
    RemoteForward 52698 localhost:52698

4. Press Enter and Ctrl(⌃)+D to end editing

Turris configuration

1. Connect to Turris

  $ ssh root@

2. Create authorize_keys file

  On router:
  # mkdir ~/.ssh
  # chmod 0700 ~/.ssh
  On your PC:
  $ ssh root@ "tee -a ~/.ssh/authorized_keys" < ~/.ssh/
  On router:
  # chmod 0600 ~/.ssh/authorized_keys

Hardening ssh

If you want to be sure that nobody can log in with the password without having the key, edit the configuration file of the sshd service and restart it:

  # vi /etc/ssh/sshd_config
  change the following strings:
  '#PasswordAuthentication yes' in 'PasswordAuthentication no'
  '#ChallengeResponseAuthentication yes' in 'ChallengeResponseAuthentication no'
  (save the file and exit from vi)
  # service sshd restart