Read / Write permissions in /opt directory

Solution 1:

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

Solution 2:

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

Solution 3:

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