Last active
August 29, 2015 13:57
-
-
Save zhanghui9700/9681072 to your computer and use it in GitHub Desktop.
create ceph user and change passwd without shell interactive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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