Score:0

Permission denied (13) with rsync command

rs flag

I am trying to make a script that will eventually go into crontab to execute every once in a while. I want to backup a directory from my HDD to my usb drive. Here is the script:


SOURCE_DIR="/home/user/mc-server-files"
BACKUP1="/home/user/sandisk-usb"

rsync -urDvz --delete "$SOURCE_DIR" "$BACKUP1"

Before putting into crontab, I want to test it, but when I run the script with source /home/user/scripts/3day-san-backup.sh I get the following

sending incremental file list
rsync: [generator] recv_generator: mkdir "/home/user/sandisk-usb/mc-server-files" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
mc-server-files/

sent 37,588 bytes  received 338 bytes  75,852.00 bytes/sec
total size is 2,099,733,334  speedup is 55,363.95
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]

After making the directory myself, I got some more errors:

sending incremental file list
mc-server-files/banned-ips.json
mc-server-files/banned-players.json
mc-server-files/bukkit.yml
mc-server-files/commands.yml
mc-server-files/eula.txt
mc-server-files/help.yml
mc-server-files/ops.json
mc-server-files/permissions.yml
mc-server-files/server-icon.png
mc-server-files/server.properties
mc-server-files/spigot.yml
mc-server-files/usercache.json
mc-server-files/version_history.json
mc-server-files/whitelist.json
rsync: [generator] recv_generator: mkdir "/home/user/sandisk-usb/mc-server-files/cache" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
rsync: [generator] recv_generator: mkdir "/home/user/sandisk-usb/mc-server-files/config" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***

There's more output, but it doesn't fit here. What permissions do I need to change?

Also, here is the permissions from ls -l:

drwxrwxrwx+ 11 mc-runner minecraft-runners  4096 Jun 18 15:41 mc-server-files

mc-runner cannot run sudo commands, but my user (who can run sudo) is in the minecraft-runners group

Raffa avatar
jp flag
The `-D` option requires super user i.e. `sudo` and you probably don’t need it to copy user data, so try without it to see if it works … Also compressing the stream with the option `-z` might not be needed between disks on the same machine and will negatively affect performance.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.