diff --git a/net/scripts/create-solana-user.sh b/net/scripts/create-solana-user.sh index 0978df4934..59a50abd11 100755 --- a/net/scripts/create-solana-user.sh +++ b/net/scripts/create-solana-user.sh @@ -4,26 +4,29 @@ set -ex [[ $(uname) = Linux ]] || exit 1 [[ $USER = root ]] || exit 1 -adduser solana --gecos "" --disabled-password --quiet -adduser solana sudo -adduser solana adm -echo "solana ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers -id solana +if grep -q solana /etc/passwd ; then + echo "User solana already exists" +else + adduser solana --gecos "" --disabled-password --quiet + adduser solana sudo + adduser solana adm + echo "solana ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers + id solana -[[ -r /solana-id_ecdsa ]] || exit 1 -[[ -r /solana-id_ecdsa.pub ]] || exit 1 - -sudo -u solana bash -c " - mkdir -p /home/solana/.ssh/ - cd /home/solana/.ssh/ - cp /solana-id_ecdsa.pub authorized_keys - umask 377 - cp /solana-id_ecdsa id_ecdsa - echo \" - Host * - BatchMode yes - IdentityFile ~/.ssh/id_ecdsa - StrictHostKeyChecking no - \" > config -" + [[ -r /solana-id_ecdsa ]] || exit 1 + [[ -r /solana-id_ecdsa.pub ]] || exit 1 + sudo -u solana bash -c " + mkdir -p /home/solana/.ssh/ + cd /home/solana/.ssh/ + cp /solana-id_ecdsa.pub authorized_keys + umask 377 + cp /solana-id_ecdsa id_ecdsa + echo \" + Host * + BatchMode yes + IdentityFile ~/.ssh/id_ecdsa + StrictHostKeyChecking no + \" > config + " +fi