This is continuation of this topic: https://forums.freenas.org/index.php?threads/root-user-missing-root-ssh-known_hosts.46331/ where I am giving up on trying to store public and private keys in my .ssh and instead defining a location for generated keys to connect to a server.
I have a .sh file that I can manually trigger to run a backup to a remote server on the local network. It looks like this:
This script requires manual authorization, which is why I created a public key, that I stored in /mnt/local/.backup/authorized_keys.pub on the local machine. I then created a new .sh script that contains the following:
It throws a permission denied error. Specifically the following:
The main problem in the error is the permission denied on the /mnt/local folder that I cant figure out. I am logged in as root when I execute the .sh file(s). But whatever reason the second .sh file keeps throwing the "permissions denied" error. What should I do from here?
EDIT: The public key is in the .ssh folder under authorized_keys on the remote server I want to send the backup to. But the script fails before it gets that far, due to permission errors locally.
What is rsync in the eyes of the system? What does it run as and is it possible that rsync itself does not have the required permissions?
I have a .sh file that I can manually trigger to run a backup to a remote server on the local network. It looks like this:
Code:
rsync -avzP -e ssh -i /mnt/local/ root@192.168.9.114:/DataVolume/shares/NASBackup
This script requires manual authorization, which is why I created a public key, that I stored in /mnt/local/.backup/authorized_keys.pub on the local machine. I then created a new .sh script that contains the following:
Code:
rsync -avzP -e 'ssh -i /mnt/local/.backup/authorized_keys -o StrictHostKeyChecking=no' /mnt/local 192.168.9.114:/DataVolume/shares/NASBackup
It throws a permission denied error. Specifically the following:
Code:
Use "rsync --daemon --help" to see the daemon-mode command-line options. Please see the rsync(1) and rsyncd.conf(5) man pages for full documentation. See http://rsync.samba.org/ for updates, bug reports, and answers rsync error: syntax or usage error (code 1) at main.c(1504) [Receiver=3.0.9] ./backup-start-new.sh: /mnt/local: Permission denied
The main problem in the error is the permission denied on the /mnt/local folder that I cant figure out. I am logged in as root when I execute the .sh file(s). But whatever reason the second .sh file keeps throwing the "permissions denied" error. What should I do from here?
EDIT: The public key is in the .ssh folder under authorized_keys on the remote server I want to send the backup to. But the script fails before it gets that far, due to permission errors locally.
What is rsync in the eyes of the system? What does it run as and is it possible that rsync itself does not have the required permissions?