Skip to content

Instantly share code, notes, and snippets.

@brianoflan
Last active December 16, 2016 17:41
Show Gist options
  • Save brianoflan/029e3a89d80066ab1d97a803b0280f89 to your computer and use it in GitHub Desktop.
Save brianoflan/029e3a89d80066ab1d97a803b0280f89 to your computer and use it in GitHub Desktop.
Fix AWS EC2 instance root umask for awscli and cloud-utils (and euca2ools, hiera-eyaml, gem, umask, chmod)
#!/bin/bash
main() {
forceRoot ;
local pkg='' ;
for pkg in awscli hiera-eyaml ; do
gem uninstall $pkg --executables ;
done ;
for pkg in awscli ; do
yum -y install $pkg ;
done;
for pkg in cloud-utils euca2ools awscli ; do
yum -y remove $pkg ;
done ;
umask 0022 ;
for pkg in cloud-utils euca2ools awscli ; do
yum -y install $pkg ;
done ;
for pkg in awscli hiera-eyaml ; do
gem install $pkg ;
done ;
ls -l /usr/bin/aws ;
}
forceRoot() {
[[ "$(id -u)" == "0" ]] || { echo "ERROR: Must run $0 as root." ; exit 1 ; }
}
main ;
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment