Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: how to ignore special characters

by sn1987a (Chaplain)
on Apr 15, 2015 at 15:12 UTC ( #1123512=note: print w/replies, xml ) Need Help??

in reply to how to ignore special characters
in thread header

Do the passwords have the same special characters on the different machines. Some "special" characters are treated differently inside double quotes. To avoid that use single quotes.

$ssh->send( 'rootpasswordwithspecialcharacters' . "\n" );

The single quotes are used to protect that characters in the root password. The newline is then concatenated to the end, since \n depends on being in double quotes.

Please follow up on the new thread you started. See my response at Re: How do I get to ignore special characters?.

Replies are listed 'Best First'.
Re^2: how to ignore special characters
by amagana (Acolyte) on Apr 15, 2015 at 15:42 UTC

    Thank you sn1987a

    It looks like that worked for the root password but I used the same single quotes for when I get my password changed. The script stops now at when I do a expect/send after sending passwd amagana at New UNIX Password like this..

    [root@Remotehost ~]# Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/ line 561 Expect::expect('Expect=GLOB(0xc4cc170)', 60, 'New UNIX Passwor +d:') called at line 82 main::change_password('linux-host\x{a}') called at test-a-file line 39 passwd amagana Changing password for user amagana. New UNIX password:
    $ssh->send("passwd amagana\n"); $ssh->expect(60, 'New UNIX Password:'); #linux $ssh->send( 'XxX*%xx,^xxxxXx_' . "\n"); $ssh->expect(60, 'Retype new UNIX password:'); #linux $ssh->send( 'XxX*%xx,^xxxxXx_' . "\n"); $ssh->expect(60, '#'); $ssh->send("exit\n"); $ssh->expect(60, '$'); $ssh->send("exit\n"); $ssh->close();

      Thank you sn1987a,

      Success!, My script can now send and expect from a file and push that to an array. Thank you so very much again now I just need a little more help on how to get my script to make a list of which password resets failed from each list.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1123512]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2019-04-20 12:56 GMT
Find Nodes?
    Voting Booth?
    I am most likely to install a new module from CPAN if:

    Results (109 votes). Check out past polls.

    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!