Minor fixes

This commit is contained in:
deajan 2017-02-07 21:06:02 +01:00
parent 724f488ab7
commit 7fc9a2c4fb
1 changed files with 7 additions and 4 deletions

View File

@ -53,7 +53,7 @@ function PrepareSudoers {
if [ -f "/etc/sudoers" ]; then if [ -f "/etc/sudoers" ]; then
echo "$remoteUser ALL=NOPASSWD:SETENV:/usr/bin/rsync,/usr/bin/bash" >> "/etc/sudoers" echo "$remoteUser ALL=NOPASSWD:SETENV:/usr/bin/rsync,/usr/bin/bash" >> "/etc/sudoers"
echo "Defaults:$remoteUser !requiretty" >> "/etc/sudoers" echo "Defaults:$remoteUser !requiretty" >> "/etc/sudoers"
elif [ -f "/usr/local/bin/sudoers" ]; then elif [ -f "/usr/local/etc/sudoers" ]; then
echo "$remoteUser ALL=NOPASSWD:SETENV:/usr/local/bin/rsync,/usr/local/bin/bash" >> "/usr/local/etc/sudoers" echo "$remoteUser ALL=NOPASSWD:SETENV:/usr/local/bin/rsync,/usr/local/bin/bash" >> "/usr/local/etc/sudoers"
echo "Defaults:$remoteUser !requiretty" >> "usr/local/etc/sudoers" echo "Defaults:$remoteUser !requiretty" >> "usr/local/etc/sudoers"
else else
@ -91,9 +91,12 @@ function RemoveSudoers {
} }
if [ "$1" == "set" ]; then if [ "$1" == "set" ]; then
if getent passwd | grep -v "$testUser" > /dev/null 2>&1; then
echo "Manual creation of $testUser with homedir $testUserHome" echo "Manual creation of $testUser with homedir $testUserHome"
adduser "$testUser" adduser "$testUser"
else
echo "It seems that $testUser already exists"
fi
SetupSSH "$testUser" "$testUserHome" SetupSSH "$testUser" "$testUserHome"
PrepareSudoers "$testUser" PrepareSudoers "$testUser"