3

I am on Ubuntu 14.04 LTS.

I installed buildozer and it ended up in /usr/local/bin. I can't run it without using sudo or root and that will likely cause problems down the road. Right now trying to run buildozer init will return buildozer: command not found unless I use root. How can I make the programs in /usr/local/bin/ visible without using root?

If that is not possible, is it safe for me to move buildozer to another folder that's in the PATH variable and still have it work without issues?

/usr/local/bin is already in my PATH variable.

Moving buildozer and buildozer-remote to /usr/bin/ and running buildozer init gives:

Traceback (most recent call last):
  File "/usr/bin/buildozer", line 9, in <module>
    load_entry_point('buildozer==0.29', 'console_scripts', 'buildozer')()
  File "/usr/local/lib/python2.7/dist-packages/buildozer/scripts/client.py", line 13, in main
    Buildozer().run_command(sys.argv[1:])
  File "/usr/local/lib/python2.7/dist-packages/buildozer/__init__.py", line 971, in run_command
    getattr(self, cmd)(*args)
  File "/usr/local/lib/python2.7/dist-packages/buildozer/__init__.py", line 1015, in cmd_init
    copyfile(join(dirname(__file__), 'default.spec'), 'buildozer.spec')
  File "/usr/lib/python2.7/shutil.py", line 83, in copyfile
    with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: 'buildozer.spec'

EDIT: I changed directories to where am actually doing the Python work and it worked fine. Thanks so much!! :)

muru
  • 193,181
  • 53
  • 473
  • 722
Tan Wang
  • 131
  • 1
  • 1
  • 3
  • Usually, `/usr/local/bin` is already in the PATH. You may want to make sure that the file has the executable bit set for the 'other' users (the last x in `rwxrwxrwx`). If it has, then `/usr/local/bin/` is not in your path. Either modify your path or move the file to `/usr/bin/`. There should be no issues. – Jos Jul 25 '15 at 21:34
  • Hard to know from what you posted. It is either : 1. /usr/local/bin is not on your path , 2. wrong permissions (chmod a+x /usr/local/bin/your_program) or 3 your program requires root priviliges to run, such as for example using a priviliged port. – Panther Jul 25 '15 at 21:36
  • I moved buildozer to /usr/bin/ and now running 'buildozer init' gives errors. Please see the update in the post. Edit: I changed directories to where am actually doing the Python work and it worked fine. Thanks so much!! :) – Tan Wang Jul 25 '15 at 21:46

1 Answers1

1

Use ls -l to give you a long list. The result should look something like this:

drwxr--r-- 10 root root 4096 Jul 25 22:17 usr

The fields here show you the access rights to the file, file's number of hard links, the username of the owner, the name of the group that owns the file, size of the file in bytes, date and time of the file's last modification, and name of the file, respectively.

What you are interested in is the access rights to the file and user and group owner of the file. If it says "root root", then you must have root privileges - use sudo command - to write or execute the file.

You can use the chmod chown and chgrp commands to modify the permissions of the file. I would however discourage you from letting users apart from root write or execute files in the /usr/bin directory. It can lead to compromising the security of your system.

Error edited thanks to @Martin Thornton.

shredalert
  • 169
  • 1
  • 1
  • 9
  • I did not notice that error @Martin Thornton, thanks for bringing it my attention. Will edit answer. – shredalert Jul 25 '15 at 22:42
  • 1
    You missed my point. Now no-one but root can run or view any files under`usr`. It is *normal* for users to execute files in `/usr/bin`, just not to be able to write to them. – Martin Thornton Jul 25 '15 at 22:51
  • Since the question included "I can't run it without using sudo or root" I was assuming that could have been part of the problem. – shredalert Jul 25 '15 at 22:55
  • Besides `r`, other users also need `x`. – psusi Jul 26 '15 at 00:18