I host files on a shared server with Ubuntu 14.04. How does a hacker get access to my files if he got access to another user's files and how do I prevent it?
It's all about privileges.
No matter what operating system you are refering to. The way to access a certain file path on a server is through privileges assigned to server users.
A user can share access privileges with other users to access certain files, but if an user doesn't have privileges to access that path, he can reach privileges by a technique called privilege scalation exploiting server's vulnerabilities, giving him or her access to routes that are not authorized for that user.