Ssh-nopasswd

Allikas: Pingviini viki

Oled läpakas sisse loginud oma kohaliku kontoga ja tahad ligi pääsed SSH serverisse ilma passwordita?

Copy-paste skriptist faili ssh-nopasswd ja chmod +x ssh-nopasswd

#!/bin/bash
if [ "$1" = "" ]; then
  echo "ssh-nopasswd user@host"
  exit 0
fi
echo "Allow this account $(whoami)@$(hostname) to log in without password for ssh $@" 
if [ -f "$HOME/.ssh/id_dsa" ]; then
  echo "DSA key already generated"
else
  ssh-keygen -t dsa -N "" -f $HOME/.ssh/id_dsa
fi
cat $HOME/.ssh/id_dsa.pub | ssh $@ "cat >> $HOME/.ssh/authorized_keys2"
ssh $@ "echo Everything works!"

Skript käima ssh-nopasswd kasutaja@ssh_server, toksi password sisse ja edaspidi saad kohe ssh kasutaja@ssh_server sisse logida ilma salasõnata.