jueves, 30 de septiembre de 2010

Script baja usuarios FTP

Evidentemente despues de añadir la entrada anterior tenia que añadir esta...
le he llamado /root/scripts/baja_usuarios_ftp.sh

#!/bin/bash

USUARIOFTP=" "

echo -----------------------------------------------------
echo Introduzca un nombre de usuario ftp
read USUARIOFTP

cat /etc/passwd |cut -d: -f1 | grep $USUARIOFTP
if [ $? -eq 0 ]; then
        userdel $USUARIOFTP
        echo Usuario eliminado
        echo elimine el directorio $(cat /etc/passwd |cut -d: -f6 | grep $USUARIOFTP)
else
        echo "ERROR#1: El usuario $USUARIOFTP no existe"
fi

No hay comentarios: