Cannot execute SUID bash script with sudo as SSH command [duplicate]

The wondrous ssh has a cure for everything. The point is to add the -t flag to force ssh to allocate a pseudo-tty:

ssh -t remote-server 'sudo ls'