sudo groupadd operator
添付の /etc/sudoers.d/operator をつくる
添付の /root/create_user.sh をつくる
sudo chmod +x /root/create_user.sh
sudo /root/create_user.sh <GitHubユーザー名>
| #!/bin/sh | |
| if [ $# -ne 1 ]; then | |
| echo "USAGE: "`basename $0`" USERNAME" 1>&2 | |
| exit 1 | |
| fi | |
| USER=$1 | |
| useradd -m -s /bin/bash -g operator --password $USER $USER | |
| mkdir /home/${USER}/.ssh | |
| chmod 700 /home/${USER}/.ssh | |
| touch /home/${USER}/.ssh/authorized_keys | |
| chmod 600 /home/${USER}/.ssh/authorized_keys | |
| curl https://github.com/${USER}.keys > /home/${USER}/.ssh/authorized_keys | |
| chown -R ${USER}:operator /home/${USER}/.ssh |
| %operator ALL = NOPASSWD: ALL | |
| # User rules for operator group | |
| %operator ALL=(ALL) NOPASSWD:ALL |