I recently decided to try to learn some bash scripting and as a fun exercise I decided to make a script to open up a daily file for me to write notes in whenever the script is run.
It worked fine until I logged out and back in to the system later, when I received an error
/usr/local/bin/notes: line 45: /home/MY_USERNAME/notes/2010-10-01:Permission denied
Code
I might be mistaken, but this certainly doesn't seem like something that shouldn't require extra permissions, does it?
Editor is set to nano
File's permissions are -rw-rw-r--
Script's permissions are -rwxr-xr-x
check the permission on the file with
ls -l /path/to/your/file
you should see something like
-rw-r--r--
r mean readable, w writeable, and x executable.
the first set is for your user, the second set of three is for your group, and the third set is for anyone.
so in my example, the file i have shown is read/write for me, and read only for my group and for any other user.
Use the chmod command to change permissions.
chmod 744 file
will make the file read/write/exec for you, and just read for user/world.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With