Update ADconnection.sh

This commit is contained in:
PierreGode 2018-08-24 09:26:48 +02:00 committed by GitHub
parent 038648c91d
commit 9b4a334c7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1316,6 +1316,17 @@ fi
########################################### Leave Realm ################################
leave(){
whoelse=$( who -ut | grep -v old | awk '{print $1}' )
homeshome=$( sudo realm list | grep domain-name | awk '{print $2}' )
homes=$( ls /home/$homeshome | head -1 )
if [ "$homes" = "$whoelse" ]
then
echo ""
echo "you are logged in as an AD user.. canceling request"
echo "only administrator has
echo ""
exit
else
LEFT=$(sudo realm discover | grep configured | awk '{print $2}')
DOMAIN=$(realm discover | grep -i realm.name | awk '{print $2}')
SSSD=$( sudo cat /etc/sssd/sssd.conf | grep domain | awk '{print $3}' | head -1 )