Question

I'm trying to set up an sftp only user for my Amazon EC2 instance. Good tutorial on this here.

I am having a bit of trouble at this step:

Using the AWS Management Console, generate a new key pair for the third-party user.
Using puttygen, import the new key (keyname.pem) and copy its public key.
On the server, create the .ssh directory for the new user:
    sudo mkdir /home/newusername/.ssh
Paste the public key into /home/newusername/.ssh/authorized_keys.

Creating the key in AWS Management Console, no problem. It allows me to download and save the private key. I'm understanding the next step to mean import the the key from my EC2 instance to my local machine, copy the public key, and then paste it into the specified file.

Question is, how do I import the keypair using PuttyGen and copy the public key on my local machine? will it be a separate file from the private key?

PS both my local machine and ec2 instance are Ubuntu 12.04

Was it helpful?

Solution

Using puttygen is one of way of doing it, but I believe it's just easier to use ssh-keygen from a linux box to generate the private/public key pair.

From a linux box as 'root':

$ adduser myuser
$ su myuser -
$ ssh-keygen -t rsa

Your private/public key pair will be /home/myuser/.ssh/id_rsa (private) and /home/myuser/.ssh/id_rsa.pub (public)

Now just paste the content of id_rsa.pub into /home/myuser/.ssh/authorized_keys in the machine where you are running your sftp server. Make sure the authorized_keys file has 600 permissions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top