forked from irwanmohi/AutoScriptSSH
-
Notifications
You must be signed in to change notification settings - Fork 1
/
user-password
56 lines (53 loc) · 1.21 KB
/
user-password
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# Created by http://www.embex.online
# Modified by 0123456
red='\e[1;31m'
blue='\e[1;34m'
green='\e[0;32m'
NC='\e[0m'
echo "Connecting to Server..."
sleep 0.5
echo "Checking Permision..."
sleep 0.4
CEK=0123456
if [ "$CEK" != "0123456" ]; then
echo -e "${red}Permission Denied!${NC}";
echo $CEK;
exit 0;
else
echo -e "${green}Permission Accepted...${NC}"
sleep 1
clear
fi
clear
echo " "
echo " "
echo " "
read -p "Input USERNAME to change password: " username
egrep "^$username" /etc/passwd >/dev/null
if [ $? -eq 0 ]; then
read -p "Input new PASSWORD for user $username: " password
clear
echo "Connecting to Server..."
sleep 0.5
echo "Generating New Password..."
sleep 0.5
egrep "^$username" /etc/passwd >/dev/null
echo -e "$password\n$password" | passwd $username
clear
echo " "
echo " "
echo " "
echo "-------------------------------------------"
echo -e "Password for user ${blue}$username${NC} successfully changed."
echo -e "The new Password for user ${blue}$username${NC} is ${red}$password${NC}"
echo "-------------------------------------------"
echo " "
echo " "
echo " "
else
echo " "
echo -e "Username ${red}$username${NC} not found in your VPS"
echo " "
exit 0
fi