Java Reference
In-Depth Information
Your public key is
id_rsa.pub
, and you'll need to add that to a file named
~/.ssh/authorized_keys
on the server.
To do that, make the
.ssh
directory on the server first. I'll show the login prompt
on the server as
Server$
so you can tell which machine I'm on.
$
ssh yourname@example.com
Password:
Welcome to My Awesome Minecraft Server
Last login: Mon Feb 16 12:16:57 from xyzzy-plugh
Server$
mkdir .ssh
Now back on your computer, copy the
id_rsa.pub
file (or whatever your
.pub
file
is named) up to the server using
scp
, putting it in the
.ssh
directory and
renaming it
authorized_keys
:
$
scp id_rsa.pub yourname@example.com:~/.ssh/authorized_keys
That will copy the file to your
.ssh
directory under your home (“~”), and name
it
authorized_keys
. If you want to later, you can add keys from other machines
into this file (that's why “keys” is plural). But for now you just have this one
entry.
Finally, you need to go back on the server and check and fix the file permis-
sions. The
.ssh
directory should be readable and listable only by you, and the
files inside should be readable by you alone. In most cases,
ssh
will not work
at all
if the file permissions aren't restricted. It's for your own good.
You can set the file permissions using the
chmod
command:
$
ssh yourname@example.com
Password:
Welcome to My Awesome Minecraft Server
Last login: Mon Feb 16 12:26:13 from xyzzy-plugh
Server$
cd .ssh
Server ~/.ssh$ chmod 700 .
Server ~/.ssh$ chmod 600 authorized_keys
Now from your computer, you should be able to
ssh
or
scp
without having to
specify a password:
$
ssh yourname@example.com
Welcome to My Awesome Minecraft Server
Last login: Mon Feb 16 12:32:07 from xyzzy-plugh
Server$
And we're in!
Your next question may be, “Swell, but how do I get OUT?” Fair enough.