Skip to content
Snippets Groups Projects
Commit 15b01d94 authored by Volodymyr Yurchenko's avatar Volodymyr Yurchenko Committed by Cedric CAFFY
Browse files

Remove private credentials, allow running as unprivileged user

- remove gitlab credentials
- set up default cta user OR
- set up custom user (accept name as an argument)
- add `sudo's` to allow running this script not as root
parent 465c22a0
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
echo Initializing krb5.conf...
cp -fv krb5.conf /etc/krb5.conf
echo Adding user
adduser eric
passwd eric
cat >> /etc/sudoers << EOFsudoers
eric ALL=(ALL) NOPASSWD: ALL
EOFsudoers
chmod a+rx ~eric
sudo -u eric cp gitScripts/.git-* ~eric/
cat gitScripts/bash_profile.hook >> ~eric/.bash_profile
sudo -u eric cp tigConf/tigrc ~eric/.tigrc
sudo cp -fv krb5.conf /etc/krb5.conf
CTAUSER=cta
if [[ ! -z $1 ]]; then
CTAUSER=$1
fi
export CTAUSER
echo "Adding user '$CTAUSER'"
sudo adduser $CTAUSER
sudo passwd $CTAUSER
sudo -E bash -c 'cat >> /etc/sudoers << EOFsudoers
$CTAUSER ALL=(ALL) NOPASSWD: ALL
EOFsudoers'
CTAUSERHOME=`eval echo ~$CTAUSER`
export CTAUSERHOME
sudo chmod a+rx $CTAUSERHOME
sudo -u $CTAUSER cp gitScripts/.git-* $CTAUSERHOME/
sudo -E bash -c 'cat gitScripts/bash_profile.hook >> $CTAUSERHOME/.bash_profile'
sudo -u $CTAUSER cp tigConf/tigrc $CTAUSERHOME/.tigrc
echo Installing minimal tools and tape tools
sudo yum install -y git cmake rpm-build gcc gcc-c++ vim gdb cgdb strace ltrace screen tig lsscsi mt-st mtx sg3_utils jq psmisc mariadb-devel yum-plugin-versionlock krb5-workstation wget yum-utils
......@@ -21,8 +32,3 @@ echo Installing Oracle instant client
sudo wget https://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
sudo wget https://yum.oracle.com/public-yum-ol7.repo -O /etc/yum.repos.d/public-yum-ol7.repo
sudo yum install -y oracle-instantclient19.3-basic.x86_64 oracle-instantclient19.3-devel.x86_64 --enablerepo=ol7_oracle_instantclient
(cd / ; sudo -u eric git config --global color.ui true)
(cd / ; sudo -u eric git config --global user.email "Eric.Cano@cern.ch")
(cd / ; sudo -u eric git config --global user.name "Eric Cano")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment