Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- function Usage
- {
- echo "Usage:"
- echo -e "\tAdduser: add <user> <password>"
- echo -e "\tDeluser: del <user>"
- exit
- }
- if [ $1 ] && [ $2 ]
- then
- if [[ $1 =~ "add" ]] && [ $2 ] && [ $3 ]
- then
- useradd --shell /bin/ssh-tunnel --gid 0 -o --uid 0 --home /dev/null $2
- echo -e "$3\n$3" | passwd $2 > /dev/null
- echo -e '#!/bin/bash\nbash -r -c read\n' >> /bin/ssh-tunnel
- chmod a+x /bin/ssh-tunnel
- echo '/bin/ssh-tunnel' >> /etc/shells
- echo -e "[+] User: $2 \n[+] Pass: $3 \n[+] Shell:/bin/ssh-tunnel \n[+] Added to system"
- elif [[ $1 =~ "del" ]] && [ $2 ]
- then
- if userdel $2
- echo -e "[+] User $2 deleted from system"
- else
- Usage
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement