add user script

This commit is contained in:
Kameron Kenny 2024-05-03 11:22:07 -04:00
parent 5bd314c68c
commit 5f30b31ec9
No known key found for this signature in database
GPG Key ID: E5006629839D2276
1 changed files with 14 additions and 0 deletions

14
3_users.sh Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
grep jenkins /etc/group >/dev/null 2>&1 || sroupadd jenkin
grep jenkins /etc/passwd >/dev/null 2>&1 || useradd jenkins -g jenkins -G docker -m
[[ ! -d '/home/jenkins/.ssh' ]] && mkdir /home/jenkins/.ssh
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