15 lines
643 B
Bash
15 lines
643 B
Bash
#!/bin/bash
|
|
|
|
grep jenkins /etc/group >/dev/null 2>&1 || groupadd jenkin && echo 'jenkins group exists'
|
|
grep jenkins /etc/passwd >/dev/null 2>&1 || useradd jenkins -g jenkins -G docker -m && echo 'jenkins user exists'
|
|
|
|
[[ ! -d '/home/jenkins/.ssh' ]] && mkdir /home/jenkins/.ssh || echo '/home/jenkins/.ssh exists'
|
|
|
|
grep 'jenkins@localhost.thelinuxpro.net' >/dev/null 2>&1 || echo 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDZzcq/InUD3bbrVC+7HzIjhaiz8Nc21ZO1Wu6OsVijs jenkins@localhost.thelinuxpro.net' >> /home/jenkins/.ssh/authorized_keys
|
|
|
|
chown -R jenkins.jenkins /home/jenkins/.ssh
|
|
chmod -R 0700 /home/jenkins/.ssh
|
|
|
|
usermod -a -G docker kkenny
|
|
|