#Linux
Linux
If you've never heard of ssh-keys before, you'll need to generate one like this
$ ssh-keygen -t dsa
This creates a directory ~/.ssh/
and stores the key files
$ ls -l .ssh/
-rw------- 1 gnibbler gnibbler 668 Aug 22 2004 .ssh/id_dsa
-rw------- 1 gnibbler gnibbler 603 Aug 22 2004 .ssh/id_dsa.pub
You need to copy id_dsa.pub
to the RPi. There is a very easy way to do this using a helper script.
$ ssh-copy-id -i ~/.ssh/id_dsa.pub [email protected]
You'll need to type the pi
user password one last time
Next time you log in, you won't be prompted for a password
$ ssh [email protected]
Linux raspberrypi 3.1.9+ #174 PREEMPT Sun Jul 22 19:04:28 BST 2012 armv6l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Type 'startx' to launch a graphical session
How do I disable password logins?
Once you have set up key-based logins, you don't need to log in using a password anymore; you can disable it, which is much more secure.
First, log in to your Raspberry Pi and open
/etc/ssh/sshd_config
asroot
; for example, runsudo vim /etc/ssh/sshd_config
.Find the line containing
PasswordAuthentication
; it probably reads#PasswordAuthentication yes
.Change this line so it reads
PasswordAuthentication no
Restart your Raspberry Pi, or just
sshd
.
Arch Linux
To restart sshd
on Arch, run sudo rc.d restart sshd
.
Debian/Raspbian
To restart sshd
on Debian based distributions, run sudo /etc/init.d/sshd restart
.