Why can't I run a program I manually installed in /opt/?

I'm trying to install a game called Teeworlds. I plan on installing it inside of /opt since it is stand-alone and from what I've read this is the right place for it. However, I'm having trouble doing this.

I type in the following command in the terminal:

tar xvzf ~/teeworlds.tar.gz -C /opt

But it gives me errors since I don't have enough permissions. So I try doing this with sudo then it works but then I don't have enough permission to access the teeworlds folder because it is now owned by root.

I understand that I can do chown and all that stuff but is it really this much trouble to get something like this to work or am I just doing something wrong?


Solution 1:

Yes, /opt is owned by root. You need to make the file executable by you. It's not exactly much trouble. It's one command:

sudo chmod +x filename. 

However, teeworlds is in the repositories. Is there a very good reason why you want to install it manually? You should always install software from the repositories whenever possible. It's much easier, faster, more reliable and secure.

sudo apt-get install teeworlds

Or click here: teeworlds Install teeworlds.

Solution 2:

what you done is right every thing owned by root can't accessible from other user you have always to change the owner of files or give permissions to read and write the folder for other user opt folder is owned by root so you can't create new folder to it without permissions ...

Solution 3:

runable files should have 755 permissions with root owner (see ls -l output in /usr/bin). Any user can run this commands but only root can change them.