Command to remove a non-administrator user
This commit is contained in:
parent
21f03af0f7
commit
3b0a7821d8
4
Makefile
4
Makefile
|
@ -28,6 +28,7 @@ install:
|
||||||
install -m 755 src/${APP}-renew-cert ${DESTDIR}${PREFIX}/bin
|
install -m 755 src/${APP}-renew-cert ${DESTDIR}${PREFIX}/bin
|
||||||
install -m 755 src/${APP}-rmlist ${DESTDIR}${PREFIX}/bin
|
install -m 755 src/${APP}-rmlist ${DESTDIR}${PREFIX}/bin
|
||||||
install -m 755 src/${APP}-rmemail ${DESTDIR}${PREFIX}/bin
|
install -m 755 src/${APP}-rmemail ${DESTDIR}${PREFIX}/bin
|
||||||
|
install -m 755 src/${APP}-rmuser ${DESTDIR}${PREFIX}/bin
|
||||||
install -m 755 src/${APP}-ignore ${DESTDIR}${PREFIX}/bin
|
install -m 755 src/${APP}-ignore ${DESTDIR}${PREFIX}/bin
|
||||||
install -m 755 src/${APP}-unignore ${DESTDIR}${PREFIX}/bin
|
install -m 755 src/${APP}-unignore ${DESTDIR}${PREFIX}/bin
|
||||||
install -m 755 src/${APP}-addxmpp ${DESTDIR}${PREFIX}/bin
|
install -m 755 src/${APP}-addxmpp ${DESTDIR}${PREFIX}/bin
|
||||||
|
@ -55,6 +56,7 @@ install:
|
||||||
install -m 644 man/${APP}-renew-cert.1.gz ${DESTDIR}${PREFIX}/share/man/man1
|
install -m 644 man/${APP}-renew-cert.1.gz ${DESTDIR}${PREFIX}/share/man/man1
|
||||||
install -m 644 man/${APP}-rmlist.1.gz ${DESTDIR}${PREFIX}/share/man/man1
|
install -m 644 man/${APP}-rmlist.1.gz ${DESTDIR}${PREFIX}/share/man/man1
|
||||||
install -m 644 man/${APP}-rmemail.1.gz ${DESTDIR}${PREFIX}/share/man/man1
|
install -m 644 man/${APP}-rmemail.1.gz ${DESTDIR}${PREFIX}/share/man/man1
|
||||||
|
install -m 644 man/${APP}-rmuser.1.gz ${DESTDIR}${PREFIX}/share/man/man1
|
||||||
install -m 644 man/${APP}-ignore.1.gz ${DESTDIR}${PREFIX}/share/man/man1
|
install -m 644 man/${APP}-ignore.1.gz ${DESTDIR}${PREFIX}/share/man/man1
|
||||||
install -m 644 man/${APP}-unignore.1.gz ${DESTDIR}${PREFIX}/share/man/man1
|
install -m 644 man/${APP}-unignore.1.gz ${DESTDIR}${PREFIX}/share/man/man1
|
||||||
install -m 644 man/${APP}-addxmpp.1.gz ${DESTDIR}${PREFIX}/share/man/man1
|
install -m 644 man/${APP}-addxmpp.1.gz ${DESTDIR}${PREFIX}/share/man/man1
|
||||||
|
@ -79,6 +81,7 @@ uninstall:
|
||||||
rm -f ${PREFIX}/share/man/man1/${APP}-renew-cert.1.gz
|
rm -f ${PREFIX}/share/man/man1/${APP}-renew-cert.1.gz
|
||||||
rm -f ${PREFIX}/share/man/man1/${APP}-rmlist.1.gz
|
rm -f ${PREFIX}/share/man/man1/${APP}-rmlist.1.gz
|
||||||
rm -f ${PREFIX}/share/man/man1/${APP}-rmemail.1.gz
|
rm -f ${PREFIX}/share/man/man1/${APP}-rmemail.1.gz
|
||||||
|
rm -f ${PREFIX}/share/man/man1/${APP}-rmuser.1.gz
|
||||||
rm -f ${PREFIX}/share/man/man1/${APP}-ignore.1.gz
|
rm -f ${PREFIX}/share/man/man1/${APP}-ignore.1.gz
|
||||||
rm -f ${PREFIX}/share/man/man1/${APP}-unignore.1.gz
|
rm -f ${PREFIX}/share/man/man1/${APP}-unignore.1.gz
|
||||||
rm -f ${PREFIX}/share/man/man1/${APP}-addxmpp.1.gz
|
rm -f ${PREFIX}/share/man/man1/${APP}-addxmpp.1.gz
|
||||||
|
@ -103,6 +106,7 @@ uninstall:
|
||||||
rm -f ${PREFIX}/bin/${APP}-addemail
|
rm -f ${PREFIX}/bin/${APP}-addemail
|
||||||
rm -f ${PREFIX}/bin/${APP}-renew-cert
|
rm -f ${PREFIX}/bin/${APP}-renew-cert
|
||||||
rm -f ${PREFIX}/bin/${APP}-rmlist
|
rm -f ${PREFIX}/bin/${APP}-rmlist
|
||||||
|
rm -f ${PREFIX}/bin/${APP}-rmuser
|
||||||
rm -f ${PREFIX}/bin/${APP}-ignore
|
rm -f ${PREFIX}/bin/${APP}-ignore
|
||||||
rm -f ${PREFIX}/bin/${APP}-unignore
|
rm -f ${PREFIX}/bin/${APP}-unignore
|
||||||
rm -f ${PREFIX}/bin/${APP}-addxmpp
|
rm -f ${PREFIX}/bin/${APP}-addxmpp
|
||||||
|
|
|
@ -9,11 +9,13 @@ man/freedombone-config.1.gz
|
||||||
man/freedombone-sec.1.gz
|
man/freedombone-sec.1.gz
|
||||||
man/freedombone-clientcert.1.gz
|
man/freedombone-clientcert.1.gz
|
||||||
man/freedombone-addcert.1.gz
|
man/freedombone-addcert.1.gz
|
||||||
|
man/freedombone-adduser.1.gz
|
||||||
man/freedombone-addlist.1.gz
|
man/freedombone-addlist.1.gz
|
||||||
man/freedombone-addemail.1.gz
|
man/freedombone-addemail.1.gz
|
||||||
man/freedombone-renew-cert.1.gz
|
man/freedombone-renew-cert.1.gz
|
||||||
man/freedombone-rmlist.1.gz
|
man/freedombone-rmlist.1.gz
|
||||||
man/freedombone-rmemail.1.gz
|
man/freedombone-rmemail.1.gz
|
||||||
|
man/freedombone-rmuser.1.gz
|
||||||
man/freedombone-ignore.1.gz
|
man/freedombone-ignore.1.gz
|
||||||
man/freedombone-unignore.1.gz
|
man/freedombone-unignore.1.gz
|
||||||
man/freedombone-addxmpp.1.gz
|
man/freedombone-addxmpp.1.gz
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
MY_USERNAME=$1
|
||||||
|
|
||||||
|
if [ ! $MY_USERNAME ]; then
|
||||||
|
echo 'Please specify a username to remove'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d /home/$MY_USERNAME ]; then
|
||||||
|
echo "Home directory does not exist for $MY_USERNAME"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f /home/$MY_USERNAME/.freedombone_administrator ]; then
|
||||||
|
echo "The administrator user cannot be removed"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo '>>> REMOVE USER <<<'
|
||||||
|
read -p "Do you really wish to remove the user '$MY_USERNAME' (y/n) ?" yn
|
||||||
|
if [[ $yn != 'y' && $yn != 'Y' && $yn != 'yes' && $yn != 'Yes' && $yn != 'YES' ]]; then
|
||||||
|
echo "User $MY_USERNAME was not removed"
|
||||||
|
exit 4
|
||||||
|
fi
|
||||||
|
|
||||||
|
freedombone-rmxmpp -e "$MY_USERNAME@$HOSTNAME"
|
||||||
|
|
||||||
|
userdel -r $MY_USERNAME
|
||||||
|
|
||||||
|
if [ -d /home/$MY_USERNAME ]; then
|
||||||
|
rm -rf /home/$MY_USERNAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "User $MY_USERNAME was removed"
|
||||||
|
|
||||||
|
exit 0
|
Loading…
Reference in New Issue