26 lines
755 B
Python
26 lines
755 B
Python
#!/usr/bin/python3 -u
|
|
|
|
import sys
|
|
import argparse
|
|
import os
|
|
#from pastafariutils.unix import add_user, del_user, change_password
|
|
from pathlib import Path
|
|
from subprocess import call, DEVNULL
|
|
import json
|
|
import time
|
|
import shutil
|
|
import pwd
|
|
import distro
|
|
import subprocess
|
|
from pastafariutils import linux
|
|
|
|
parser=argparse.ArgumentParser(prog='delete_user.py', description='Delete user in linux system')
|
|
|
|
parser.add_argument('--user', help='The unix user', required=True)
|
|
|
|
args=parser.parse_args()
|
|
|
|
if not linux.shell_command('sudo userdel -r {}'.format(args.user)):
|
|
linux.json_log('Sorry, cannot delete theuser, please check permissions and the user exists', error=1, status=1, progress=100, no_progress=0, return_message=0, result=None)
|
|
exit(1)
|
|
|