I set up a server to accept ssh
without passwords, and it works fine for nonprivileged commands.
However, when I try to run sudo
commands, I'm still asked for a password:
$ ssh -t test@192.168.1.52 "ls"
Desktop Documents Downloads Music Pictures Public Templates Videos
Connection to 192.168.1.52 closed.
$ ssh -t test@192.168.1.52 "sudo ls"
[sudo] password for test:
Desktop Documents Downloads Music Pictures Public Templates Videos
Connection to 192.168.1.52 closed.
$
Googling seems to indicate that ssh -t
should let sudo
run without asking for a password, but this is not the case above.
Any suggestion what should I do to get sudo commands to work without asking for a password?
OS is CentOS 7.5.
/etc/sudoers
file withvisudo
to allow sudo to be used without a password. You can additionally set for which commands and which users/groups it applies to. This may give you a good lead.