Project

General

Profile

Actions

Feature #8420

closed

How to use my own keypair instead of foreman's created ?

Added by Biswajit Banerjee almost 10 years ago. Updated almost 10 years ago.

Status:
Duplicate
Priority:
High
Assignee:
Category:
-
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

How to use my own specified keypair instead of default created by foreman while provisioning a new instance?
Please let me know if that posible. I am not able to login to new ec2 instaces after it is getting created.
Tried with copying my public key to user's authorize-keys by passing it via user-data. But that did not work as well.
Any pointer here will be a great help for me.

Regards,
Biswajit


Related issues 1 (1 open0 closed)

Is duplicate of Foreman - Feature #8319: ec2 compute sould be able to use existing ssh keysNew11/07/2014Actions
Actions #1

Updated by Dominic Cleal almost 10 years ago

  • Is duplicate of Feature #8319: ec2 compute sould be able to use existing ssh keys added
Actions #2

Updated by Dominic Cleal almost 10 years ago

  • Status changed from New to Duplicate

#8319 covers this request already I think. If you want to add your own, best to do it in user data or a finish template. If that's not working, it would be best to debug it a bit and e-mail the foreman-users list or ask on #theforeman with more details if you're still stuck, as it's probably an issue in your template or image.

Actions #3

Updated by Biswajit Banerjee almost 10 years ago

Thank, Dominic. I will definately look into other things around like template or image.

Here is the user-data I am using ,
#!/bin/bash -ex
useradd -d /home/demo -s /bin/bash -c 'demo user' demo
echo demo:***** | chpasswd
mkdir -p /home/demo
chown -R demo:root /home/demo
mkdir -p /home/demo/.ssh
touch authorized_keys
echo 'PUBLIC KEY' >> /home/demo/.ssh/authorized_keys
chmod 600 /home/demo/.ssh/authorized_keys
/usr/bin/perl -p -i -e "s/PermitRootLogin no/PermitRootLogin yes/" /etc/ssh/sshd_config
echo " User demo has been set , please try login with user-demo."
echo 'Hello world - I just executed user-data!' > /root/helloworld

Anything wrong here ?

Actions #4

Updated by Dominic Cleal almost 10 years ago

Permissions on /home/demo/.ssh might need to be 0700, but I'm guessing unless you can get the logs from sshd and attempted logins.

Actions #5

Updated by Shlomi Zadok almost 10 years ago

  • Assignee set to Shlomi Zadok
Actions

Also available in: Atom PDF