Score:2

Can not access a files that belong to other users

in flag

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...

David avatar
cn flag
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.
aldegalan avatar
in flag
@David What could be the solution? Even if this is out of how I presented it here
David avatar
cn flag
As I already stated I do not think there is a solution, you need permission to access the files.
Soren A avatar
mx flag
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.
Score: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.

Soren A avatar
mx flag
According to the question there are read-rights to both owner, group and other.
Score:1
jp flag

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.

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.