From 3b0a7821d8ccfdb09d32ae6b224d33c9340b1c7a Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 26 Oct 2015 15:11:37 +0000 Subject: [PATCH] Command to remove a non-administrator user --- Makefile | 4 ++++ debian/source/include-binaries | 2 ++ man/freedombone-rmuser.1.gz | Bin 0 -> 462 bytes src/freedombone-rmuser | 37 +++++++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 man/freedombone-rmuser.1.gz create mode 100755 src/freedombone-rmuser diff --git a/Makefile b/Makefile index 84923ee1..9c167dbc 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,7 @@ install: install -m 755 src/${APP}-renew-cert ${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}-rmuser ${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}-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}-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}-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}-unignore.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}-rmlist.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}-unignore.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}-renew-cert rm -f ${PREFIX}/bin/${APP}-rmlist + rm -f ${PREFIX}/bin/${APP}-rmuser rm -f ${PREFIX}/bin/${APP}-ignore rm -f ${PREFIX}/bin/${APP}-unignore rm -f ${PREFIX}/bin/${APP}-addxmpp diff --git a/debian/source/include-binaries b/debian/source/include-binaries index 80eb1e1d..1b8a147e 100644 --- a/debian/source/include-binaries +++ b/debian/source/include-binaries @@ -9,11 +9,13 @@ man/freedombone-config.1.gz man/freedombone-sec.1.gz man/freedombone-clientcert.1.gz man/freedombone-addcert.1.gz +man/freedombone-adduser.1.gz man/freedombone-addlist.1.gz man/freedombone-addemail.1.gz man/freedombone-renew-cert.1.gz man/freedombone-rmlist.1.gz man/freedombone-rmemail.1.gz +man/freedombone-rmuser.1.gz man/freedombone-ignore.1.gz man/freedombone-unignore.1.gz man/freedombone-addxmpp.1.gz diff --git a/man/freedombone-rmuser.1.gz b/man/freedombone-rmuser.1.gz new file mode 100644 index 0000000000000000000000000000000000000000..84d6d92d6bad7d1e275757daa83a403afb368205 GIT binary patch literal 462 zcmV;<0Wtm`iwFRFK`vGR1C3H$kDD+MeCJoJcxfvYXi~Mhi>j*ON|UHbK!NnsuLs*~ zz&dOr+oacje@;X{A~@*~LTGk8GrQifSi(UgmP$}1G0>tjs9^&B^ev>!!t~YTjSs$i zKmDV@-jSXe*bv!~#`nB1UxL4#ZxY`dQTq|V4uv|R0RmFVfRutuZmcF&X*hEZS_!Z< zg86MMie57Rx=pium5<7PKYb+;__Jq!O!AxEDl1m$*7u5<8_<7kD}F@zMDq{|_dmj8 zL`r3WVlP~Vy>oI;MBAX71i0rZS>ye}b+yA*X(!lKE~E9r7;0-ipV4Zv<;i<`>CC0c)e+lz_ zu}pWq7b^-IW!=^Yct;iepcPe?GZS`qp;hm_kZLbmWYHp9%pjRxUrm$OS7$WlR-iGY z!WqPyV9IX0TExdM>> 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