Skip to main content
added 346 characters in body
Source Link
Mee
  • 13
  • 5

I have a VPS. There is a web-application running on this VPS. A user can log into his account, create a project (the system automatically creates a folder for this project) and then, he can create and edit PHP files via the file manager within this folder/project. He edits those files via web-application's interface.

That is a sort of, online PHP editor, where people can create, edit and run PHP files, and then download them.

My VPS runs CentOS7 and Apache.

So the problem is, when the user tests his code and runs the files, that he has created, he can get access to the system in general and to similar folders of other users. So, this way, he can write and execute a command to list all files and directories outside his folder and see, what is happening there. Or can delete/copy/create/etc... files outside his folder. That should not be permitted. And that is a security flaw.

Also, user's scripts are ran by the "apache" user.

How is it possible to restrict his files from accessing anything, outside his directory/folder/project?

Edit

I basically need something like the shared hostings have... Where all of the users are on the same server, but cant access files of each other. On a shared hosting, you can use file manager to navigate through folders and edit php files, but those php files cant access the folders/accounts of other users on the shared hosting...

I have a VPS. There is a web-application running on this VPS. A user can log into his account, create a project (the system automatically creates a folder for this project) and then, he can create and edit PHP files via the file manager within this folder/project. He edits those files via web-application's interface.

That is a sort of, online PHP editor, where people can create, edit and run PHP files, and then download them.

My VPS runs CentOS7 and Apache.

So the problem is, when the user tests his code and runs the files, that he has created, he can get access to the system in general and to similar folders of other users. So, this way, he can write and execute a command to list all files and directories outside his folder and see, what is happening there. Or can delete/copy/create/etc... files outside his folder. That should not be permitted. And that is a security flaw.

Also, user's scripts are ran by the "apache" user.

How is it possible to restrict his files from accessing anything, outside his directory/folder/project?

I have a VPS. There is a web-application running on this VPS. A user can log into his account, create a project (the system automatically creates a folder for this project) and then, he can create and edit PHP files via the file manager within this folder/project. He edits those files via web-application's interface.

That is a sort of, online PHP editor, where people can create, edit and run PHP files, and then download them.

My VPS runs CentOS7 and Apache.

So the problem is, when the user tests his code and runs the files, that he has created, he can get access to the system in general and to similar folders of other users. So, this way, he can write and execute a command to list all files and directories outside his folder and see, what is happening there. Or can delete/copy/create/etc... files outside his folder. That should not be permitted. And that is a security flaw.

Also, user's scripts are ran by the "apache" user.

How is it possible to restrict his files from accessing anything, outside his directory/folder/project?

Edit

I basically need something like the shared hostings have... Where all of the users are on the same server, but cant access files of each other. On a shared hosting, you can use file manager to navigate through folders and edit php files, but those php files cant access the folders/accounts of other users on the shared hosting...

Source Link
Mee
  • 13
  • 5

How to secure user folders on the server from the scripts running in other user folder on the same server?

I have a VPS. There is a web-application running on this VPS. A user can log into his account, create a project (the system automatically creates a folder for this project) and then, he can create and edit PHP files via the file manager within this folder/project. He edits those files via web-application's interface.

That is a sort of, online PHP editor, where people can create, edit and run PHP files, and then download them.

My VPS runs CentOS7 and Apache.

So the problem is, when the user tests his code and runs the files, that he has created, he can get access to the system in general and to similar folders of other users. So, this way, he can write and execute a command to list all files and directories outside his folder and see, what is happening there. Or can delete/copy/create/etc... files outside his folder. That should not be permitted. And that is a security flaw.

Also, user's scripts are ran by the "apache" user.

How is it possible to restrict his files from accessing anything, outside his directory/folder/project?