- or download this
[root@ip:/tmp] ssh root@ip "sudo -u bob date"
root@ip's password:
sudo: sorry, you must have a tty to run sudo
[root@ip:/tmp]
but ssh -t root@ip "sudo -u bob date" solves the problem
- or download this
use Carp qw(carp confess croak);
use Net::SSH2;
...
print $stdout;
$ssh->disconnect();
exit(0);
- or download this
perl myssh.pl "sudo -u bob date" won't work
perl myssh.pl "date" works and gives the date command output.