Skip to content

Commit

Permalink
Renamed ec2-user to admin
Browse files Browse the repository at this point in the history
  • Loading branch information
andsens committed Nov 10, 2012
1 parent 4321023 commit 31a2b7c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Plugin removed: "ec2-run-user-data" is back in the standard bootstrapping process and has been simplified

#### Minor changes: ####
* Plugin modified: "ec2-user" renamed to "admin-user". Login name is now "admin"

### 2012-11-06 Anders Ingemann <[email protected]> ###

Expand Down
4 changes: 2 additions & 2 deletions plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ You can run them via the ``--plugin`` option when bootstrapping:
Adds some common packages to the AMI.
* ``unattended-upgrades``
Enables unattended upgrades with aptitude. Your EC2 server will upgrade itself daily.
* ``ec2-user``
Creates a user named 'ec2-user', gives it sudo rights and disables the root login.
* ``admin-user``
Creates a user named 'admin', gives it sudo rights and disables the root login.
* ``remount``
Remounts the bootstrapped volume.
With this plugin you can inspect the results of the bootstrapping process without launching an instance.
Expand Down
5 changes: 5 additions & 0 deletions plugins/admin-user
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
insert_task_after $TASK_PACKAGES \
$plugindir/admin-user-tasks/add-sudo-package
insert_task_after $TASK_INITSCRIPTS \
$plugindir/admin-user-tasks/create-user
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash
ec2user_name='ec2-user'
admin_username='admin'

# Create the user and add him to the 'sudo' group
chroot $imagedir useradd --create-home --shell /bin/bash $ec2user_name
chroot $imagedir useradd --create-home --shell /bin/bash $admin_username

# Allow ec2-user to use sudo without a password
sed -i "/^root\tALL=(ALL) ALL/a ec2-user\tALL=(ALL) NOPASSWD: ALL" $imagedir/etc/sudoers
sed -i "/^root\tALL=(ALL) ALL/a $admin_username\tALL=(ALL) NOPASSWD: ALL" $imagedir/etc/sudoers

# ec2-get-credentials should add the pubkey to the new user account and not root
sed -i "s/^username='root'/username='$ec2user_name'/" $imagedir/etc/init.d/ec2-get-credentials
sed -i "s/^username='root'/username='$admin_username'/" $imagedir/etc/init.d/ec2-get-credentials

# Disallow root login
sed -i "s/^PermitRootLogin yes/PermitRootLogin no/" $imagedir/etc/ssh/sshd_config
5 changes: 0 additions & 5 deletions plugins/ec2-user

This file was deleted.

0 comments on commit 31a2b7c

Please sign in to comment.