Skip to content

Instantly share code, notes, and snippets.

@bigwheel
Created April 27, 2016 07:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bigwheel/5e7d26b886303ae1f82d0287b63ba371 to your computer and use it in GitHub Desktop.
Save bigwheel/5e7d26b886303ae1f82d0287b63ba371 to your computer and use it in GitHub Desktop.
暫定的にパスワードを振られたアカウントを多数受領したときに、一括で自分のパスワードへ変える方法(ttyが有効になっていてsudo権限がありsshpassがインストールされている前提)
#!/usr/bin/env bash
set -ex
ip_list=()
ip_list+=("192.168.1.1")
ip_list+=("192.168.1.2")
ip_list+=("192.168.1.3")
ip_list+=("192.168.1.4")
for i in "${ip_list[@]}"
do
echo "<<ここに自分のパスワードを書く>>" | sshpass -p kbigwheel ssh $i -l kbigwheel -o 'StrictHostKeyChecking no' sudo passwd --stdin kbigwheel
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment