Score:0

Can not create a directory on Mount usb drive

eg flag

I want to create a cronjob that makes a backup on a usb drive. The script works well but if the machine is restarted, the usb drive is unmounted. So I connect via ssh and run the following command to mount the usb drive:

sudo mount /dev/sda1 /mnt/backups/

and as you can see the usb drive is mounted

df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           776M  4,7M  772M   1% /run
/dev/mmcblk0p2   29G   11G   18G  38% /
tmpfs           3,8G     0  3,8G   0% /dev/shm
tmpfs           5,0M  4,0K  5,0M   1% /run/lock
tmpfs           4,0M     0  4,0M   0% /sys/fs/cgroup
/dev/mmcblk0p1  253M  121M  132M  48% /boot/firmware
tmpfs           776M   88K  776M   1% /run/user/126
tmpfs           776M   80K  776M   1% /run/user/1000
/dev/sda1        58G  3,8M   58G   1% /mnt/backups

but when the cronjob run or I manually exec the bash I get the following error:

2021-12-24T07:37:12.790+0100    Failed: error dumping metadata: error creating metadata file 24122021-2/website/users.metadata.json: open 24122021-2/website/users.metadata.json: permission denied

I run the following command to change permission, but same problem:

sudo chmod 777 -R /mnt/backups/
Johan Palych avatar
us flag
Ubuntu Server, desktop version? USB drive file system?(in the terminal:lsblk -o NAME,FSTYPE,LABEL,SIZE,MOUNTPOINT,UUID or lsblk -f). You should define an access control list for the folder: for example, we change the owner to your username: sudo chown $USER /mnt/backups/. Editing fstab to automount partitions at startup. Creating a cronjob from the same user.
user.dz avatar
ng flag
Unmount it and check permissions to `/mnt` and `/mnt/backups` folders.
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.