Skip to content

Instantly share code, notes, and snippets.

@zhanghui9700
Last active August 29, 2015 13:57
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 zhanghui9700/9681072 to your computer and use it in GitHub Desktop.
Save zhanghui9700/9681072 to your computer and use it in GitHub Desktop.
create ceph user and change passwd without shell interactive
#!/bin/bash
#coding=utf-8
for host in "$@"
do
echo $host
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@$host "useradd -d /home/ceph -m ceph; echo password | passwd ceph; echo 'ceph ALL = (root) NOPASSWD:ALL' | tee /etc/sudoers.d/ceph; chmod 0440 /etc/sudoers.d/ceph;"
done
echo "usage: create_ceph_user.sh host1 host2 host3"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment