in reply to Find and replace MD5 hash from file
I can see two problems with your system command: (1) parts of your hashed password strings contain $ signs which will be interpreted by the shell as environment variables. (2) If you then single quote your s/// expression to protect from shell interpolation, those same $ signs are interpreted as variables by Perl; the slashes are also interpreted by Perl. So replace this:
system("ssh -o StrictHostKeyChecking=no root\@localhost /usr/bin/perl +-p -i -e s/$hash2/$hash1/ee ha +shfile")
with this:
system("ssh -o StrictHostKeyChecking=no root\@localhost /usr/bin/perl +-p -i -e 's/\Q$hash2\E/\Q$hash1\E/' ha +shfile")
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Find and replace MD5 hash from file
by ikegami (Patriarch) on Jun 29, 2011 at 19:32 UTC | |
by philipbailey (Curate) on Jun 29, 2011 at 19:45 UTC | |
by ikegami (Patriarch) on Jun 29, 2011 at 20:19 UTC | |
by philipbailey (Curate) on Jun 29, 2011 at 20:36 UTC | |
by ikegami (Patriarch) on Jun 29, 2011 at 20:40 UTC | |
|
In Section
Seekers of Perl Wisdom