83

I installed Android Studio in my /opt directory without a hitch and have been using it. Recently, though, Android Studio informed me of an update. It won't perform the update, however, because it says it doesn't have Read / Write permissions in the opt directory where it's installed.

Can anyone recommend the best remedy for this situation? I would prefer not to move my installation to another directory. I also don't know that I want to change permissions on the directory, though I might be tempted to do so for the update, then revert it back.

Error message:

Studio does not have write access to /opt/android-studio. Please run it by a privileged user to update
Yushin
  • 109
wayneeusa
  • 969

6 Answers6

141

I changed the owner of the android studio directory from root to my user account and it worked. Here is the command, where $USER will change by itself to your current active user:

sudo chown -R $USER:$USER /opt/android-studio
Rinzwind
  • 309,379
Latif
  • 1,426
8

You can move the directory from /opt to your home using comand:

sudo cp -r /opt/android-studio ~/

Or to give permissions you have to use chmod:

sudo chmod +w /opt/android-studio/some-file

to add permissions to all dir recursive:

sudo chmod +w -R /opt/android-studio/some-file

Take a look on my answer https://askubuntu.com/a/638799/150504 that explain a little about chmod and how to use

Maythux
  • 87,123
8

I did set the group of /opt/android-studio (and /opt/android-sdk) to users and added write permission to the group.

In my case, the group users existed already. But as hint:

sudo addgroup users

I had to add my user to the users group:

sudo adduser $USER users

Then set the group of the directory:

sudo chown -R root:users /opt/android-studio

Because updates need to write files:

sudo chmod -R g+w /opt/android-studio

I used this instructions once, I hope i did not forget something

edit: This way, files shall not be too wide accessible, but still usable by selected users

ArcticSnowSky
  • 81
  • 1
  • 1
1

I had a similar problem with Rubymine.

sudo chown -R $USER:$USER /opt/Rubymine

worked for me too, but it can be dangerous changing permissions in system folders. Probably better just to run the installation once as root to allow updating. eg.

sudo updatedb && sudo locate rubymine.sh
sudo /path/to/rubymine.sh 
0

I was getting the same error. Running following command from terminal solved the problem.

sudo chown -R $USER:$USER /opt/idea-IC-173.4548.28/

You don't need to be in same directory in order to execute the command.

abu_bua
  • 11,313
Tahirhan
  • 121
-1
sudo chmod -R 777 your_android_studio_location_path/

For example (in my Ubuntu 16.04):

sudo chmod -R 777 /home/igor/Android/