File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ if ! id | grep -q root; then
4
+ echo " must be run as root"
5
+ exit
6
+ fi
7
+
8
+ echo " Reseting root password to [root]..."
9
+
10
+ # it was blanked out via:
11
+ # root_password=$(cat /etc/shadow | grep root | awk -F ':' '{print $2}')
12
+ # sed -i -e 's:'$root_password'::g' /etc/shadow
13
+
14
+ passwd << -_EOF_
15
+ root
16
+ root
17
+ _EOF_
18
+
19
+ echo " ssh: resecuring, password now required..."
20
+
21
+ # it was opened up via:
22
+ # sed -i -e 's:PermitEmptyPasswords no:PermitEmptyPasswords yes:g' /etc/ssh/sshd_config
23
+ # sed -i -e 's:UsePAM yes:UsePAM no:g' /etc/ssh/sshd_config
24
+
25
+ sed -i -e ' s:PermitEmptyPasswords yes:PermitEmptyPasswords no:g' /etc/ssh/sshd_config
26
+ sed -i -e ' s:UsePAM no:UsePAM yes:g' /etc/ssh/sshd_config
27
+ /etc/init.d/ssh restart
28
+
29
+ echo " Complete..."
30
+
You can’t perform that action at this time.
0 commit comments