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 :
chown student: PATH_TO_ROOT_USER_PRIVILEGED_DIR
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
studentuser?If I am wrong, please tell me the right solution.
P.S.
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.
/var/lib/mysqlbefore 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:34rootcan 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 usechown. There is also concept ofgroupsand for more fine-grained controlAccess Control Lists (ACL). What are you going to do in/var/lib/mysqlanyway? Under normal circumtances all access to it should go via MySQL daemon. – Janne Pikkarainen Dec 1 '11 at 8:35