Skip to content

Instantly share code, notes, and snippets.

@Peregrinox
Last active February 17, 2018 18:50
Show Gist options
  • Save Peregrinox/50c7c2e1bc063a09536a4c904db61861 to your computer and use it in GitHub Desktop.
Save Peregrinox/50c7c2e1bc063a09536a4c904db61861 to your computer and use it in GitHub Desktop.
passwordless only ssh
sudo systemctl enable ssh.service
sudo systemctl start ssh.service

With that you can login with the osmc user.

enable passwordless:

create /.ssh/authorized_keys and copy public key with the osmc user

chmod 700 /home/osmc/.ssh
chmod 644 /home/osmc/.ssh/authorized_keys

from local linux system:

cat ~/.ssh/id_rsa.pub | ssh pi@raspberrypi.local 'mkdir .ssh/ && cat >> .ssh/authorized_keys'

From the internet

To force mapping on your router:

login in your server and run:

sudo apt-get install miniupnpc
upnpc -e "ssh external" -a `ip route get 8.8.8.8 | awk '{print $NF; exit}'` 2223 23 TCP

 

Disabling password login

Open up the SSHD config file

sudo nano /etc/ssh/sshd_config

Change these parameters to no

ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no

Reload SSHD

sudo systemctl restart ssh.service

read: https://www.jaredwolff.com/blog/passwordless-ssh-raspberry-pi/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment