Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am newbie on Linux Ubuntu machine.

I logged in to the Ubuntu with username: student.

There are some directories only allowed root user to access, for example /var/lib/mysql ,(I know I can use sudo to access but it is not what I want). If I want to get the access privilege on those directories with student account, is it so that I can run the following command :


and after that, I can access that directory by using my own account ? am I right?

  • If I am right, then will root user lose the access privilege because I changed it to student user?

  • If I am wrong, please tell me the right solution.


please don't concern on what I am going to do on /var/lib/mysql directory, that is only my example, as I mentioned above, I mean generally *for those directories which only have root privilege*, can I use chown to change access privilege and will root user then loose the access because of the change made by chown ? I just wanna know the effect of chown.

share|improve this question

migrated from Dec 1 '11 at 12:30

This question came from our site for system and network administrators.

What do you intended to do in that directory? – quanta Dec 1 '11 at 8:31
I think you need to look closer at /var/lib/mysql before you do anything. It is almost certainly currently owned by the mysql user. If you change permissions on that folder, you are almost certainly going to completely trash your mysql install. There is almost no good reasons anything should have access to that folder other then the user the mysql daemon is running under. – Zoredache Dec 1 '11 at 8:34
@Mellon: Partially right. root can happily enter any directory and access any file, though. But if take away the ownership from any other user than root, then that regular user will lose the access to that particular directory. Regular user cannot use chown. There is also concept of groups and for more fine-grained control Access Control Lists (ACL). What are you going to do in /var/lib/mysql anyway? Under normal circumtances all access to it should go via MySQL daemon. – Janne Pikkarainen Dec 1 '11 at 8:35
@ Zoredahce and @ Janne, please see my P.S. in my post. I just want to know the effect of using chown, which does not mean I will do some stupid thing. – Mellon Dec 1 '11 at 8:49

root will never lose access. Even if you change the file's owner/group.

Please never ever change the owner of /var/lib/mysql!

If you change it mysql server might not be able to read/write its files anymore.

For your access problem: you could add your user to the group root.

share|improve this answer

You must log in to answer this question.