Couldn't write a bash script, which calls the backup and then changes the permissions with chmod ?
linux how to allow user to read/write/delete files created from root in a specific folder
-
25-06-2022 - |
题
I use automysqlbackup
to backup my mysql database.
The problem is I can only run this program using sudo automysqlbackup
. This program dumps the backup into my folder /home/user/backup
but theses files are owned by root and when I connect via ftp to this folder I cannot delete or read them.
Is it possible that any files created by root in the folder /home/user/backup
can be read/write/deleted by user "user" ?
Or is there a way I can run the automysqlbackup
with user "user" ?
解决方案
其他提示
For the first question : you can use SUID, for example :
chmod 4750 file1.txt
Here in 4750, 4 indicates SUID bit set, 7 for full permissions for owner, 5 for read and execute permissions for group, and no permissions for others.
For example, you can chmod your command, and your user may execute your backup command
For the second question, you can upgrade the user rights with the file /etc/sudoers.
If you need more help, say me.