2

I have a plugin that must read some files every X minutes (this plugin is running under user1), those files belong to user2 (from another application), the structure is something like this:

drwxr-xr-x. 2 user2 5536 4096 sep  2 11:09 directory1
#Inside this directory, it contains some files:
-rw-r--r--. 1 user2 5536  0 mar 10  2020 file1
-rw-r--r--. 1 user2 5536  0 mar  8  2018 file2

When I run the plugin, it does not let me access these files, it is returning this error:

check your filesystem (permissions/usage/integrity) and disk devices

Changing the owner of the directory and the files is not an option (because those files are used by another application).

I also tried to change the permissions to 777 but it returns the same error.

ACLs are not an option...

aldegalan
  • 123
  • 5
  • The permissions need to be changed and you can not change the permissions. I do not see how any one is going to have a solution to this. You simply can not do what you are trying to do. At least the way you have presented it here. – David Sep 02 '21 at 09:20
  • @David What could be the solution? Even if this is out of how I presented it here – aldegalan Sep 02 '21 at 09:24
  • As I already stated I do not think there is a solution, you need permission to access the files. – David Sep 02 '21 at 09:28
  • 1
    Tha access rights on the files show that you are allowed to read them. The error "check your filesystem ..." indicate that there are something else wrong. Have you tried to boot from live USB/DVD and check the filesystem's (fsck ....) ? Also, how do you access the files ? What is the path to the files, how is the filesystem mounted .. and so on. – Soren A Sep 02 '21 at 11:11

2 Answers2

1

Users can access files owned by other users. What you should do is make the users that will "share" files/directories belong to the same group, and assign the same group to files/directories, with suitable permissions (read/write) for the group.

Detailed instructions are shown here and here. There is no point in copy-pasting them, as they belong to SO. Note that in the example the group is admin, but it could be anything. Please follow it, and if you find any difficulty post exactly what you did, and exactly what problem you found.

Make sure all directories above directory1 allow for reading from a different user.

You could also check this, a 10-minute read.

1

I think this: "Make sure all directories above directory1 allow for reading from a different user." is a clue to the solution (in the answer by sancho.s ReinstateMonicaCellio).

You should ask the owner of the files to make the whole path readable for you, either set it for 'others' or create a group with read permissions all the way and enter the relevant user IDs into that group.

An alternative is to ask the owner of the files to move the files somewhere else, where it is easier or safer to give you read access.

sudodus
  • 45,126
  • 5
  • 87
  • 151