1

I am a Ubuntu user, recently I switched from Ubuntu 14.04(Unity one) to Ubuntu 14.04 (GNOME one). I have used Ubuntu 14.04 for around one year and never faced issues in creating, modifying and deleting files in my home folder when logged in as administrator.

Now in GNOME I don't have permissions to delete, open and modify some files. I cannot even move one folder into another. There is an error saying you cannot handle this folder because you don't have permissions to read it.

I followed some links and tried to change permissions by right clicking on the folders but still I don't get permissions. If I perform operations in terminal using 'sudo' there are no problems but why cannot I do things through GUI? How to get these permissions? These problems weren't there in my previous Ubuntu, I was the owner of all the files and folder and could do anything from GUI only.

I am facing one more problem. I am an android studio user and there are some projects in my home folder, some of the project files are shown with a lock icon on them and only root can access them. So, when I run studio it cannot access those files and shows error. Moreover I have installed android studio, made a project and saved it. I created a desktop entry for the studio.sh file so that I don't have to run the studio.sh file from terminal again and again. When I open android studio now whether through terminal or even the launcher I am greeted with fresh setup again. I run the studio.sh file using 'sudo' only. I feel like both the issues are there because I don't have required permissions. Any help is appreciated.

2

To fix it and conquer back all files in your home directory, run

sudo chown -R $USER: ~

And for the future:

Do not run GUI applications with sudo, but use for example gksu or at least sudo -i or sudo -H to prevent it from taking ownership of files in your home directory.

1

Simpliest way:

You need to change the owner of those files:

sudo chown `whoami` path/to/file

Makes your current user (output of the command whoami) to the owner of the files.

sudo chown -cR username:groupname path/to/folder

Makes user username of group groupname owner of folder and all subfolders and files. The name of the group is probably the same as your username. Listing every group a user is in can be done via:

groups username
  • Thanks for the help. First command is working fine, but in second one terminal is showing usages for example I want to be owner of all files and folders in my home directory so I entered: sudo -cR gautamp8 /home but terminal shows different usages on pressing enter. – gautamp8 Jan 26 '16 at 12:02
  • @gautamp8 correct, you also need the group in the recursive command, i edited the post. – h0ch5tr4355 Jan 26 '16 at 12:12
  • Well, tried this also, as you said groupname is same as the username. I used this: sudo -cR gatamp8:gautamp8 /home but not working. I explored more on your answer and found that this command will change the owner of all folders and subfolders sudo chown -R username:group directory and its working for me. askubuntu.com/questions/6723/… . You can update your answer with this command and I will mark it as correct :) Thanks! – gautamp8 Jan 26 '16 at 12:32
  • @gautamp8 The -c shouldn't have an effect there, it just says, that only files are displayed where the changing of the ownership actually took place. – h0ch5tr4355 Jan 26 '16 at 12:37
  • Okay I understand, I am not an much experienced with terminal commands but chown -R worked for me. I tried your solution by using different ways but it is not working. – gautamp8 Jan 26 '16 at 12:59

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.