Skip to content

Instantly share code, notes, and snippets.

@ysaotome
Last active January 19, 2017 07:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ysaotome/6026594 to your computer and use it in GitHub Desktop.
Save ysaotome/6026594 to your computer and use it in GitHub Desktop.
#!/bin/bash
# File:change_root_password.sh
# 2013/07/18 @ysaotome
#===============================================
#設定したいrootパスワード「hoge##123」の部分を改変
#===============================================
ROOT_PASSWORD='hoge##123'
#===============================================
SALT=$(/usr/bin/uuidgen| /usr/bin/tr -d '-')
/usr/sbin/usermod -p $(/usr/bin/perl -e 'print crypt(${ARGV[0]}, ${ARGV[1]})' ${ROOT_PASSWORD} ${SALT}) root
# /usr/bin/curl https://github.com/ysaotome.keys >> /root/.ssh/authorized_keys
@ysaotome
Copy link
Author

サーバの新規作成時や起動時に下記画面に「change_root_password.sh」の記載内容をコピー&ペーストで再起動

起動時スクリプト入力画面

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment