I have two machines, local and remote.
I want to back up my files and folders to the remote machine automatically, using rsync to transfer files and folders, using ssh-keygen to automatically log into the remote machine.
I can do this as ssh root, but that will be a bit of security risk: someone can log directly into the remote machine as root if the local files have been compromised.
I tried rssh but I couldn’t log in automatically using ssh-keygen.
What I am looking for is a way to create an ssh user with limited access to shell commands and with access only to a specific directory safe for automatically logging in with no harm to the remote machine.
Best Answer
You can limit the command run when using a ssh key-pair by using
command="...."
into~/.ssh/authorized_keys
file. Example took from here: