Ec2-user password for running sudo -H -u

amazon ec2gitpasswordsudo

I have to run this command to initialize gitosis:

sudo -H -u git gitosis-init < /home/ec2-user/id_rsa.pub

But that asks me for a password for ec2-user:

$ sudo -H -u git gitosis-init < id_rsa.pub
[sudo] password for ec2-user: 

I do not have a password as i use the default .pem key file to login.

I know i can probably login as the git user and do this, but is there any other way?

Update:

Using Linux AMI 12.09 (micro-instance), in region us-east-1 (N. Virginia)

Best Answer

As you discovered, the root user can sudo to any other user, so just stick an extra sudo in front.

sudo sudo -H -u git gitosis-init < /home/ec2-user/id_rsa.pub

Please don't kick yourself too hard.