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
  • How are you trying to update ? How did you install ? PPA ? Can you run android studio as root ? ie sudo /opt/android-studio and then update ?
    – Mark Kirby
    Jun 30, 2015 at 14:00
  • 1
    I guess you copied it to the /opt/ directory. I won't recommend keeping it there, so you don't have to bother with the permission issues. It is best to use umake to set up your Android development environment. Jun 30, 2015 at 14:39
  • @markkirby I copied it there and used the installation script studio.sh I would run by sudo, but studio.sh starts the installation again. Surprised that I don't see a file to run to just start the program. Maybe I should gedit the installation script to see where the executable is ..
    – wayneeusa
    Jul 3, 2015 at 17:38
  • i recommend awarding one of the answers the status of correct answer. otherwise, it may be misleading for users who come by this post in the future - if a correct answer has not been awarded 1 year after, it means that neither answer is correct. When, in fact, both efficiently address the problem at hand. i UPVOTED your question, BTW : )
    – tony gil
    Aug 21, 2016 at 9:51
  • 1
    I ran into permission trouble routinely by leaving /opt at default root permissions, and I will not leave everything in my home directory; That has its own pitfalls. There just isn't enough double checking done by install scripts to guide you through potential pitfalls, and sudo just will not save the day. For the love of Mike, this is still happening in 2020. I gave up opened up permissions on /opt and called it a day. Does it worry me? You bet. But for a non-server system; notsomuch.... Oct 11, 2020 at 1:28

6 Answers 6


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
  • 2
    really works for me.. My 10 days search end here Apr 21, 2016 at 4:43
  • 13
    This will work, but are there disadvantages in having all the files and directories in some random subdirectory of /opt owned by a random user? If the installation is in /opt this might mean that it's intended for multiple users, so one might expect other users on the system to be running studio. Might this be a problem somehow?
    – Yannick
    Sep 3, 2016 at 17:45
  • 1
    used this trick to configure php editor like Geany to xampp installations's /opt/lampp/htdocs directory to write and run in xampp server. hth..
    – Steer360
    Oct 31, 2016 at 0:49
  • you are the man ! Jan 18, 2018 at 13:59
  • 4
    good point @Yannick but who in the world has more than one user on their Ubuntu setup 😂 Feb 6, 2019 at 21:36

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

  • Do I need to specify the specific executable file that will have this permission for the folder? I tried it with the studio.sh, but I don't think that's the actual file that's running when I click the icon to run android studio.
    – wayneeusa
    Jul 3, 2015 at 17:52
  • didnt work for me. When creating directory. tried sudo chmod +w -R /opt/android-sdk-linux
    – david
    Oct 15, 2016 at 2:44
  • First we have to run studio.sh from bin directory using sudo then only the write permission is reflected.
    – dev_ry
    Oct 26, 2017 at 5:32

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


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 
  • Me too! But when I try your solution, it asks for license information again, so I'm not sure what to do at that point... put it in again? I don't want to mess up my license terms...
    – mltsy
    Jun 14, 2017 at 19:10
  • I'm not 100% sure I would consider /opt a system folder, despite it's "official" categorization as such. It's not in the same category as /usr, /etc, and the like. Its design is to be a central repository for app installations that are accessible to any user. To this extent, it fails miserably unless (IME) unless /opt is simply opened up to the universe, which I've been forced to do. Very unsafe. But I've basically had it up to ^^^ here with fighting my own system during development and have learned the very hard and expensive way that not doing so yields a miserable waste of my time. Oct 11, 2020 at 1:34
sudo chmod -R 777 your_android_studio_location_path/

For example (in my Ubuntu 16.04):

sudo chmod -R 777 /home/igor/Android/
  • 7
    Setting file permission masks to 777 is almost always bad advice. -1 Sep 13, 2016 at 20:34
  • Its bad advice, but for now it worked so I upvote.
    – david
    Oct 15, 2016 at 2:45
  • 2
    @david 777 means anyone (including anyone through internet) can access, modify and delete the file. "it worked" is not a good excuse to open such a critical vulnerability to your system. Apr 21, 2017 at 11:47
  • @david Smashing your PC to bits, going to the shop and buying a new one, then installing the latest version of Android Studio on it would also "work" but is bad advice and shouldn't be upvoted. The point is there are often multiple ways to "solve" a problem, some of which are the "wrong" way and some are the "right" way. This answer is almost certainly the wrong way. Feb 18, 2019 at 19:46
  • Upvoted back up 1. Dangerous? Yes. But so is the crazy expense of chasing down permission problems endlessly with app after app when all I want to do is develop. Would I do this on a server machine? No. Have I learned the hard way to simply open up /opt to the universe? Yep. It solves a very expensive problem: losing my time. The risk is absolutely worth it, and being a purist here is just not helpful. Good grief, I've even run into trouble with Intellij Idea in /opt with their plugins when /opt was at default permissions. Oct 11, 2020 at 1:40

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.

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.