Hey I'm working on this all purpose script to tighten a ubuntu computers security and one of the things in it is to disable guest account through lightdm.conf. The way my script is setup or at least I want it to be setup is that if it doesn't find lightdm.conf it will make the file and insert the text. Any help would be appreciated.
#!/bin/bash
read -p "Disable guest account? yes or no: " ans
case "$ans" in
yes) if locate /etc/lightdm/ |grep lightdm.conf
then
sed -i '$ a [SeatDefaults]' /etc/lightdm/lightdm.conf &&
sed -i '$ a user-session=ubuntu' /etc/lightdm/lightdm.conf &&
sed -i '$ a greeter-session=unity-greeter' &&
sed -i '$ a allow-guest=false' /etc/lightdm/lightdm.conf &&
echo "Guest account disabled succesfuly"
else cat > /etc/lightdm/lightdm.conf
sed -i '$ a [SeatDefaults]' /etc/lightdm/lightdm.conf &&
sed -i '$ a user-session=ubuntu' /etc/lightdm/lightdm.conf &&
sed -i '$ a greeter-session=unity-greeter' &&
sed -i '$ a allow-guest=false' /etc/lightdm/lightdm.conf && echo "Guest account disabled"
fi
;;
no) echo "Will not disable guest account "
esac