Skip to content

Instantly share code, notes, and snippets.

@kzn4
Created May 28, 2017 03:55
Show Gist options
  • Save kzn4/e1c3969c2df6a1e2ac9f190b4f8885b3 to your computer and use it in GitHub Desktop.
Save kzn4/e1c3969c2df6a1e2ac9f190b4f8885b3 to your computer and use it in GitHub Desktop.
create user
#!/bin/bash
#Script auto create trial user SSH
read -p "Username : " Login
read -p "Password : " Pass
read -p "Expired (hari): " masaaktif
IP=`dig +short myip.opendns.com @resolver1.opendns.com`
useradd -e `date -d "$masaaktif days" +"%Y-%m-%d"` -s /bin/false -M $Login
exp="$(chage -l $Login | grep "Account expires" | awk -F": " '{print $2}')"
echo -e "$Pass\n$Pass\n"|passwd $Login &> /dev/null
echo -e ""
echo -e "Informasi SSH"
echo -e "=========-account-=========="
echo -e "Host: $IP"
echo -e "Port: 443,143,80"
echo -e "Username: $Login "
echo -e "Password: $Pass"
echo -e "-----------------------------"
echo -e "Aktif Sampai: $exp"
echo -e "==========================="
echo -e "Script by \e[1;33;44mKZN\e[0m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment