run a local script as root on remote server

This question already has an answer here:

  • How to use SSH to run a shell script on a remote machine? 11 answers

  • Ok, then why do you "echo mypassword" ?

    Can't you add your SSH account to the sudoers file with NOPASSWD ?

    From man sudoers :

     authenticate      If set, users must authenticate themselves via a password (or other means
                       of authentication) before they may run commands.  This default may be
                       overridden via the PASSWD and NOPASSWD tags.  This flag is on by default.

    上一篇: bash heredoc在粘贴到ssh终端时会被(随机)破坏

    下一篇: 在远程服务器上以root身份运行本地脚本