For basic passwords out of the box, you can do something like this to set the password to that well known Jumpstart password, 'newroot':-
perl -pi -e "s/^root:.?\:/root:boajrOmu7GRmY\:/" /etc/shadow
Sadly for the stronger options in Solaris 9 and onwards you need to be able to handle $ in there which I'm not enough of a Perl nut to figure a way around. The fix i've gone for is primitive, but it works.
cat /etc/shadow | sed 's/^root:.[^:]*:/root:$5$062qyog8$Vny5sE9NEDnam1rB4Dn6ObMABoBFd2R02HpCMlKRQn4:/' > /etc/shadow
...or if you have the gnu command line tools:-
gsed -i 's/^root:.[^:]*:/root:$5$062qyog8$Vny5sE9NEDnam1rB4Dn6ObMABoBFd2R02HpCMlKRQn4:/' /etc/shadow
Easiest way is to copy and paste from another server where you know it... failing that there are generators on google and bits of perl/python to do it.
No comments:
Post a Comment