S
S
semki0962016-04-29 12:13:42
linux
semki096, 2016-04-29 12:13:42

How to differentiate user rights on a file like themeforest?

On themeforest, each user has a folder where purchased files are stored. I need something similar. Think so. I need to make a specific user the owner of the file (I do not consider the group). I have a table with users. Means in this table it is necessary to enter system uid of the user and then to change the owner chown($uid, $path_to_file);
Question. Is this approach correct or are there better options? And how can I find out this very system uid when registering a user and write it to the database?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2016-04-29
@semki096

This approach is wrong.
The rights of site users will always be inherited from the user on whose behalf the web server is running, and interfering with local Linux users here is critically wrong.
Even if you make a crutch, such as running a web server from ROOT (it is fraught with hacks and fractures), and creating a local user every time, you will not be able to take out such a site on any hosting, because root rights will simply not be given there and it will be impossible to create users.
Restrict file access rights through your site, generate one-time links, create a file/owner table and check against it.

I
Ivan, 2016-04-29
@c64

can, by means of a web server to make authorization (on a session cookie) for access to the folder? without having a million users in the system.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question