{"id":1489,"date":"2022-08-18T16:29:13","date_gmt":"2022-08-18T16:29:13","guid":{"rendered":"\/blog\/?p=1489"},"modified":"2022-08-18T16:41:33","modified_gmt":"2022-08-18T16:41:33","slug":"quick-solaris-expect-scritpt-to-change-password","status":"publish","type":"post","link":"\/blog\/index.php\/quick-solaris-expect-scritpt-to-change-password\/","title":{"rendered":"Quick Solaris expect script to change password"},"content":{"rendered":"<p>#!\/bin\/bash<br \/>\ncat dbausers | while read u;do<br \/>\ncat &lt;&lt; EOF &gt; \/tmp\/chpw_${u}.exp<br \/>\n#!\/usr\/bin\/expect -f<br \/>\nset force_conservative 0<br \/>\nif {\\$force_conservative} {<br \/>\nset send_slow {1 .1}<br \/>\nproc send {ignore arg} {<br \/>\nsleep .1<br \/>\nexp_send -s &#8212; $arg<br \/>\n}<br \/>\n}<br \/>\nset timeout -1<br \/>\nspawn passwd $u<br \/>\nmatch_max 100000<br \/>\nexpect -exact &#8220;New Password: &#8221;<br \/>\nsend &#8212; &#8220;Sssspwd@1234\\r&#8221;<br \/>\nexpect -exact &#8220;\\r<br \/>\nRe-enter new Password: &#8221;<br \/>\nsend &#8212; &#8220;Sssspwd@1234\\r&#8221;<br \/>\nexpect eof<br \/>\nEOF<br \/>\nchmod 755 \/tmp\/chpw_${u}.exp<br \/>\n\/tmp\/chpw_${u}.exp<br \/>\ndone<\/p>\n","protected":false},"excerpt":{"rendered":"<p>#!\/bin\/bash cat dbausers | while read u;do cat &lt;&lt; EOF &gt; \/tmp\/chpw_${u}.exp #!\/usr\/bin\/expect -f set force_conservative 0 if {\\$force_conservative} { set send_slow {1 .1} proc send {ignore arg} { sleep .1 exp_send -s &#8212; $arg } } set timeout -1 spawn passwd $u match_max 100000 expect -exact &#8220;New Password: &#8221; send &#8212; &#8220;Sssspwd@1234\\r&#8221; expect -exact [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1489","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1489","targetHints":{"allow":["GET"]}}],"collection":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=1489"}],"version-history":[{"count":4,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1489\/revisions"}],"predecessor-version":[{"id":1494,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1489\/revisions\/1494"}],"wp:attachment":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=1489"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=1489"},{"taxonomy":"post_tag","embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=1489"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}