Permissions reseting

Hi all. So, I´m using my Umbrel server to rsync some data from another server. It goes all right, I then open Umbrel´s File Browser, but I can only access the synced directory if I go to terminal first and chmod -R 777 that synced directory. Next time, I have to do it again…how can I make these permissions to stick?
Thanks!

1 Like

rsync options to consider:
-p, --perms preserve permissions
–executability preserve executability
–chmod=CHMOD affect file and/or directory permissions
-o, --owner preserve owner (super-user only)
-g, --group preserve group
–devices preserve device files (super-user only)
–specials preserve special files

Without seeing your command or batched cron job, I can think that the users and groups of the 2 servers in questions are different. Consequently the copy on Umbrel is not accessible unless you make it 777.

To avoid these situations, I do my backups, from remote servers (not on same LAN) by:
a) creating a RSA public private key to log into the remote server with ssh as root
b) connecting to the remote server with a bash script that I include below:
#!/bin/bash
########################################

NEW bkup of dns2.domain.xxx P.I. 2019.05.09

6

Keeps 7 backups in a TIME MACHINE way (6 of them are mostly links)

It is easier to recover single files in this way.

All backups owned only by root

#########################################

Assumes the existence of

${DIR_BKUP_ROOT}/{Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday}

DIR_DATA=“root@dns2.domain.xxx:”
DIR_BKUP_ROOT=“/DailyBkup/dns2.izoom.ca”

RM=“/bin/rm”
CP=“/bin/cp”
MV=“/bin/mv”
RSYNC=“/usr/bin/rsync”
DATE=“/bin/date”

TOUCH=“/bin/touch”
MKDIR=“/bin/mkdir”
CHMOD=“/bin/chmod”

[ -x $RM -a -x $CP -a -x $RSYNC -a -x $DATE ] || exit 1

TODAY=$DATE +%A

case “$TODAY” in
‘Monday’)
LASTNIGHT=“Sunday”
PREVBACK=“Saturday”
;;
‘Tuesday’)
LASTNIGHT=“Monday”
PREVBACK=“Sunday”
;;
‘Wednesday’)
LASTNIGHT=“Tuesday”
PREVBACK=“Monday”
;;
‘Thursday’)
LASTNIGHT=“Wednesday”
PREVBACK=“Tuesday”
;;
‘Friday’)
LASTNIGHT=“Thursday”
PREVBACK=“Wednesday”
;;
‘Saturday’)
LASTNIGHT=“Friday”
PREVBACK=“Thursday”
;;
‘Sunday’)
LASTNIGHT=“Saturday”
PREVBACK=“Friday”
;;
*)
echo “ERROR: Invalid day!”
exit 2
;;
esac

############ step 1 ######################

remove the oldest backup (last night one week ago).

$RM -rf ${DIR_BKUP_ROOT}/$LASTNIGHT

copy and link to lastnight

$CP -al ${DIR_BKUP_ROOT}/$PREVBACK ${DIR_BKUP_ROOT}/$LASTNIGHT

and rsync

#$DATE > ${DIR_BKUP_ROOT}/${LASTNIGHT}/rsync.log
$RSYNC --exclude-from=/root/Crond-Production/exclude_list.rsync --stats --log-file=${DIR_BKUP_ROOT}/rsync.log -atqe ‘ssh -p 20022’ --delete ${DIR_DATA}/ ${DIR_BKUP_ROOT}/${LASTNIGHT}/

And now do the step 2

timestamp and move to proper folder

$MV ${DIR_BKUP_ROOT}/rsync.log ${DIR_BKUP_ROOT}/${LASTNIGHT}/rsync.log

touch ${DIR_BKUP_ROOT}/${LASTNIGHT}
chmod 600 ${DIR_BKUP_ROOT}/${LASTNIGHT}
~
(END)

And I also use this exclude_file List:

/2TB/
/DailyBkup/
/WeeklyBkup/
/WeeklyBkup2/
/dev/
/lost+found/
/media/
/mnt/
/net/
/proc/
/tmp/
/srv/
/sys/
/var/cache/
/var/lib/psa/dumps/
/var/lock/
/var/named/chroot/dev/
/var/named/chroot/proc/
/var/named/run-root/dev/
/var/named/run-root/proc/
/var/run-root/dev/
/var/run-root/proc/

exclude_list.rsync (END)

I hope it helps.

Of course the predefined receiving directories are created on the receiving computer (umbrel in this case) so the creator, user, group will use the default of your umbrel box. So anything inside them will be accessible.