I'm working with Apache on an ec2 box. I'm trying to generate keys for a user, apache on the system.
However, I don't have permission, because it's ec2. So, I sudo - and get asked for a password for sudo apache. I have no password. I can not set a password.
I use keys to access the systems via these users.
How on earth am I meant to generate a key for apache to use?
Keys are associated with users by storing them in the authorized_keys file in the .ssh directory of the user's home folder.
ec2-create-keypair
sudo
, or trysudo -i
) - on Amazon's Linux AMI you do not need a password (I don't know what AMI you are using)./users/home/folder/.ssh/authorized_keys
file..ssh
folder doesn't exist, create it (mkdir /users/home/folder/.ssh
) and set permissions to 700.authorized_keys
file, append to it, using something likecat ec2_public_key.pub >> /users/home/folder/.ssh/authorized_keys
The key is associated with the user by virtue of the fact it is within the user's home folder, and accessible only by that user. You may also need to permit SSH access for the specified user in
etc/ssh/sshd_config
as well as to change the shell associated with that user.As described in the manual: http://docs.amazonwebservices.com/AWSEC2/latest/CommandLineReference/ApiReference-cmd-CreateKeyPair.html