How can I allow a remote server to run a command without asking for password and any confirmation.
I use this command but it asks for password,
ssh root@0.0.0.0 /var/workingproject/notify
is there a way I can whitelist a remote server to access my server and execute a command without asking for password?
Advertisement
Answer
You can add your public key, generally found on your local box at ~/.ssh/id_rsa.pub
to your remote server’s authorized keys file. To do it automatically, you could use something like this:
ssh-copy-id -i ~/.ssh/id_rsa.pub root@0.0.0.0
Or alternatively, you can open the remote authorized keys file (~/.ssh/authorized_keys) and add your public key directly.
If you do not have a public key configured on your local instance, you can run:
ssh-keygen
to create one.