tom.haley92
Posts: 1
Joined: Sat Nov 21, 2015 8:09 pm

Permission denied

Sat Nov 21, 2015 8:21 pm

Okay so I am trying to save a file (dht11.c) into the usr/local/lib folder and can not figure out how to do so.

I tried to open the file with the leafpad text editor and use "save as" to save the file into the usr/local/lib folder and when I click the save button this message pops up "Can't open file to write"

Also, when I try to use the file manager to copy and paste the file into the folder i get this error message:
dht11.c: ERROR opening file '/usr/local/lib/dht11.c': Permission denied

Any thoughts???

sprinkmeier
Posts: 410
Joined: Mon Feb 04, 2013 10:48 am
Contact: Website

Re: Permission denied

Sun Nov 22, 2015 4:02 am

Normal users can only write to their homedirectories and /tmp.

To write anywhere else typically requires superuser privileges (i.e. "sudo").
HERE BE DRAGONS! With great power comes great responsibility!

Read this:
http://steve-parker.org/articles/others ... hawg.shtml
before proceeding

Navyscourge
Posts: 258
Joined: Sat Oct 24, 2015 1:50 pm

Re: Permission denied

Sun Nov 22, 2015 11:04 am

Navigate to the folder usr/local/lib in the desktop file manager. Click on 'Tools', then 'Open Current Folder in Terminal'. In the terminal that opens, type

Code: Select all

sudo leafpad dht11.c &
to open Leafpad with sudo permissions.

Do your editing as you did before, then Save and Close. Your file should now be saved. Close the terminal by typing 'exit', or click the usual 'X' button in the top right corner.

Why do you want this file in that folder?

User avatar
jojopi
Posts: 3271
Joined: Tue Oct 11, 2011 8:38 pm

Re: Permission denied

Sun Nov 22, 2015 11:34 am

tom.haley92 wrote:Okay so I am trying to save a file (dht11.c) into the usr/local/lib folder and can not figure out how to do so.
/usr/local/lib is primarily for holding static and dynamic library files, which have extensions of .a and .so, respectively. There is no reason to put a .c source file in that directory.

Also, you do not need to put files in /usr/local unless you need them to be accessible to multiple users. For your own use it is better to use /home/pi.

What are the installation instructions for the code you are trying to use?

Return to “Troubleshooting”