proper way to sudo over ssh

后端 未结 9 1801
抹茶落季
抹茶落季 2020-11-28 20:33

I have a script which runs another script via SSH on a remote server using sudo. However, when I type the password, it shows up on the terminal. (Otherwise it works fine)

9条回答
  •  爱一瞬间的悲伤
    2020-11-28 21:23

    The best way is ssh -t user@server "sudo ", for example ssh -t user@server "sudo reboot". It will prompt for password for user first and then root(since we are running the script or command with root privilege.

    I hope it helped and cleared your doubt.

提交回复
热议问题