Installation on Pi

I have a problem when installing emoncms on a Raspberry Pi.
With the creation of "settings" file with "$ cp default.settings.php settings.php" gives the pi this message "cp: cannot create regular file `settings.php': Permission denied".
How do I set the permissions to this file or dir, so I can create it. I did the installation 3 times and always the same problem. What did I wrong.

glyn.hudson's picture

Re: Installation on Pi

Have you tried 'sudo' before the command? See step 1: http://wiki.openenergymonitor.org/index.php?title=Raspberry_Pi#RFM12BPi_Setup

jb79's picture

Re: Installation on Pi

Hello!

Maybe you (the PI user) has insuffifficent rights, so you can try to copy the files with root rights:

Try:  "sudo cp default.settings.php settings.php"

 

If you are facing such problems again try to add "sudo " before the command to execute it with root rights.

Ian Eagland's picture

Re: Installation on Pi

Hi

Are you following the instructions exactly and cutting and pasting the commands?

could it be these steps?

cd /var/
sudo chown pi www
cd www

I have just followed the instructions exactly and it  worked for me.

It was my second attempt so I probably missed out a step the first time as I am using a tiny old monitor which makes the web instructions difficult to see. I kept the web open in one window and a terminal in the other. I had to fiddle the terminal settings so I could see the full page.

Regards

Ian

ukmoose's picture

Re: Installation on Pi

If you step back up the page to this section ... 7) Download Emoncms

there's the command

$ sudo chown pi www

which changes the ownership of the directory www to the user pi.

(All the instructions assume that you are logging in as user pi)

If you want to check which user you are logged in as you can use the command.

$ who

Assuming you are logged in as pi, if you check who owns the directory by:

$ cd /var

$ ls -latr

the list that comes up, the first column of "names" most of which should be "root" list who owns the directory. This is the line that I see for the www directory 

drwxr-xr-x  3 pi   root      4096 Nov 11 21:33 www

If this isn't similar to what you see, you can run the command again, but will now need to also change the ownership of all the files you then copied in (the emoncms directory)

fortunately you can do this with one command ;-)

$ sudo chown -R pi www

This changes the ownership of the www directory to pi, and then does the same for all files recursively (-R)

 

ukmoose's picture

Re: Installation on Pi

I have to politely disagree with the 2 suggestions to use sudo to copy the file

Sudo is the unix equivalent of using a sledgehammer to crack a nut.

Whilst it will allow you to copy the file, the file will end up with the wrong ownership and therefore permissions, which could easily cause something further down the line to break.

Copying a file using sudo ends up with the file being owned by root and not being able to be written to by the user pi. The very next line is for the user pi to edit that file.

Elektitus's picture

Re: Installation on Pi

Problem solved. Thanks for the fast reply. I had to change the ownership of the www directory to pi. Thanks to Ukmoose.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.