Sha256: e2d156bcd4ddeb89a671b0354c01abdf5baa135a1f5879d278ddb58144bbf39a
Contents?: true
Size: 980 Bytes
Versions: 7
Compression:
Stored size: 980 Bytes
Contents
homes=`find /home/* -maxdepth 0 -type d | tr '\n' ' '` curl http://169.254.169.254/2009-04-04/meta-data/public-keys/0/openssh-key 2>/dev/null >/tmp/my-key if [ $? -eq 0 ] ; then if [ ! -d /root/.ssh ] ; then mkdir -p /root/.ssh chmod 700 /root/.ssh fi dd if=/dev/urandom count=50 2>/dev/null|md5sum|awk '{ print $1 }'|passwd --stdin root >/dev/null cat /tmp/my-key >> /root/.ssh/authorized_keys chmod 600 /root/.ssh/authorized_keys for home in $homes; do user=`echo $home | awk -F '/' '{ print $3 }'` if [ ! -d $home/.ssh ] ; then mkdir -p $home/.ssh chmod 700 $home/.ssh chown $user $home/.ssh fi dd if=/dev/urandom count=50 2>/dev/null|md5sum|awk '{ print $1 }'|passwd --stdin $user >/dev/null cat /tmp/my-key >> $home/.ssh/authorized_keys chmod 600 $home/.ssh/authorized_keys chown $user $home/.ssh/authorized_keys done rm /tmp/my-key fi
Version data entries
7 entries across 7 versions & 1 rubygems