K
K
krotish2010-12-17 03:28:47
SSH
krotish, 2010-12-17 03:28:47

Amazon EC2 ssh authorization (publickey)

A bit confused with authorization on Amazon EC2.
There is an instance with debian, authorization by key for root works fine.
It is necessary to make authorization for other users.
I create a new Key Pair in the Amazon Management Console , I get a file named .pem

What's next? how to bind this key to a specific debian user?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rega, 2010-12-17
@krotish

This pair of keys is needed so that during installation of the system you can perform a root login and continue to manage the server. Use the guide that I wrote on the example of how to create a key for a user (I wrote for red-hat, it should be the same in debian)
1) We go to the server as root and add a user and generate keys for him, enter user1 in the name of the key (below)

adduser user1
cd /root/
ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa): user1
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase): <press ENTER for no password>
Enter same passphrase again: <press ENTER for no password>
Your identification has been saved in /root/.ssh/user1.
Your public key has been saved in /root/.ssh/user1.pub.

2) Copy the public key to the user user1 in authorized_keys (if there are several keys, then instead of copying, you need to add)
mkdir /home/user1/.ssh
cp user1.pub /home/user1/.ssh/authorized_keys
chown user1:user1 /home/user1/.ssh/authorized_keys

3) Rename the private key user1 to user1.pem to make it clear what it is
mv user1 user1.pem

4) We send it to the user with soap or else as a key user1.pem
5) Now the user must enter by such a command from his computer
ssh -i user1.pem [email protected] without entering a password

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question