You typically get access permission errors in Linux when you try to access files and directories created by a different user. The chown
command can be used to change the ownership of files and directories. If you are changing the ownership from user1 to user2, you need to have permissions that are higher than these users. So, typically these commands are performed using sudo
.
$ chown foouser blah.txt
$ chown foouser blahdir
$ chown :somegroup blah.txt
$ chown :somegroup blahdir
$ chown foouser:somegroup blah.txt
$ chown foouser:somegroup blahdir
$ chown -R foouser blahdir
$ chown -R :somegroup blahdir
$ chown -R foouser:somegroup blahdir
If you prefer using a GUI for changing ownership, you can do that in any file explorer. For example, in Nautilus just right-click on the file or directory and choose Properties > Permissions. Note that you need to be the root user or have launched Nautilus using superuser permissions to be able to do this.
Tried with: Ubuntu 14.04