File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -271,16 +271,16 @@ run_main()
271271 sed -i " s/^#?PermitRootLogin.*/PermitRootLogin yes/" " $USD_MOUNT_POINT " /etc/ssh/sshd_config
272272 sed -i " s/^#?PasswordAuthentication.*/PasswordAuthentication yes/" " $USD_MOUNT_POINT " /etc/ssh/sshd_config
273273 root_pass=" nakamochi"
274- crypted_root_pass=" $( mkpasswd " $root_pass " ) "
275- sed -i " s/ ^root:[^:]*:/ root:$crypted_root_pass :/ " " $USD_MOUNT_POINT " /etc/shadow
274+ crypted_root_pass=" $( mkpasswd " $root_pass " | sed ' s/\$/\\\$/g ' ) "
275+ sed -i " s| ^root:[^:]*:| root:$crypted_root_pass :| " " $USD_MOUNT_POINT " /etc/shadow
276276 echo " done."
277277 echo " Test image root password is $root_pass , ssh root login allowed."
278278 else
279279 echo -n " Finalizing image for production ... "
280280 sed -i " s/^#?PermitRootLogin.*/PermitRootLogin no/" " $USD_MOUNT_POINT " /etc/ssh/sshd_config
281281 sed -i " s/^#?PasswordAuthentication.*/PasswordAuthentication no/" " $USD_MOUNT_POINT " /etc/ssh/sshd_config
282- crypted_root_pass=" $( mkpasswd " $( tr -dc ' A-Za-z0-9' < /dev/urandom | head -c 13; echo) " ) "
283- sed -i " s/ ^root:[^:]*:/ root:$crypted_root_pass :/ " " $USD_MOUNT_POINT " /etc/shadow
282+ crypted_root_pass=" $( mkpasswd " $( tr -dc ' A-Za-z0-9' < /dev/urandom | head -c 13; echo) " | sed ' s/\$/\\\$/g ' ) "
283+ sed -i " s| ^root:[^:]*:| root:$crypted_root_pass :| " " $USD_MOUNT_POINT " /etc/shadow
284284 echo " done."
285285 fi
286286
You can’t perform that action at this time.
0 commit comments