I'm attempting to write a script that logins via ssh and provides an output of a command. However, it seems that when I try to login using a complex password, it fails to authenticate. Here is an example...

The below will fail to authenticate. If I change the password on the remote user to simple word or a word with numbers it works fine.

If you're using double quotes, then that would be the problem, because they enable variable interpolation and the @ symbol denotes a perl array. Use single quotes when you don't need/want interpolation.

$ perl script.pl Permission denied at script.pl line 12 (#1) (F) The setuid emulator in suidperl decided you were up to no good.

Uncaught exception from user code: Permission denied at script.pl line 12 at /usr/local/share/perl5/Net/SSH/Perl.pm line 255 Net::SSH::Perl::fatal_disconnect('Net::SSH::Perl::SSH2=HASH(0x14d4d48)', 'Permission denied') called at /usr/local/share/perl5/Net/SSH/Perl/SSH2.pm line 69 Net::SSH::Perl::SSH2::login('Net::SSH::Perl::SSH2=HASH(0x14d4d48)', 'user', 'proper password displayed') called at script.pl line 12

Been doing reading, it seems to be an issue with @ in the password. Can't figure out how to pass it to the ssh function in perl properly. Will update if I find something. The error is simply stating the password is not working. When it passes the password, its missing characters because of the @ symbols.

Unfortunately, it fails using Net::SSH2 module as well. It was actually the first script I wrote. I resorted to Net::SSH::Perl after trying other examples I found online. They all resulted the same. If the user has an @ symbol in the required password, it fails to authenticate.

Anyways, I appreciate you looking into this for me.

Edit: I'm actually thinking it might have to do with the double @ and !. (the password in the first post) I tried a password with just one @ and it seemed to work. However unfortunately for my use, the passwords are more complicated.