Stuff in /usr/local/bin can only be edited by admin users. That's why users can add their own files to /home/user/bin, and add this to their path. (That's what I do.)
- Do this:
sudo nedit /usr/local/bin/myfile
- Type in your password.
- You now have admin privileges to edit this one file. That does not mean all your users will have permissions to run it or edit it. This file will have admin permissions by default, because 'sudo' makes you a temporary admin.
- Edit and save the file.
- Now you have to change the permissions of the file so normal users can run it. Do:
sudo chmod g+rw /usr/local/bin/myfile
. This changes group permissions. Make sure the users who have to run this are part of the group, whatever that may be.
- If you are still having problems, give everyone permissions for this file only:
sudo chmod a+rwx /usr/local/bin/myfile
.
- You will also have to add this dir to the user's path if it is not already.
If you get an error message that you can't use sudo, edit /etc/sudoers
I think, and add your username there, one user per line.
Use whatever editor you like, even 'nano', 'vi', instead of 'nedit'.
When doing stuff with files in these "global" directories, remember to use sudo
before each command. Example:
- sudo cp /usr/bin/file $HOME
- sudo nano /usr/bin/myfile
- sudo chmod u+rwx /usr/bin/myfile
sudo
in front of your command. Otherwise you are a normal user.