SSH Public key and sudo nopasswd

generate public key

ssh-keygen

copy ssh public key to remote machine

ssh-copy-id -i <public-key-path> <remote ip/hostname>

sudo without password, log into the remote machine and run following command

sudo visudo

add ” <username> ALL=(ALL) NOPASSWD: ALL ” to the end of the file , replace <username> with your username

Leave a Reply

Your email address will not be published. Required fields are marked *