Emonpi image_ unlock files/folders

I know I’m over my head a bit but I am trying to access my pi remotely and have issues because my ISP uses Double Nat so I can’t open ports. I found a workaround that uses OpenVPN installed on my pi. I am using winSCP to access and edit my files. I keep getting access denied and need a work around. Linux skills arent the best. I did try putty and rpi-rw to unlock but that didn’t help.
Any advice /direction greatly appreciated.
Jeff

H Jeff,

The emonPi file system is in read only mode by default. Use command $ rpi-rw to enter read-write mode then $ rpi-ro to go back to read only mode.

This may be useful if you have problems with double NAT

https://www.dataplicity.com/

And there is a guide to installing Dataplicity for remote access thread too.

Thanks Paul and Stuart,
I will give this a test tonight. Would I be able to to embed an <iframe>
visualization from emoncms to my website hosted on a Digital Ocean Droplet
? I would also like remote viewing of my local Node-red dashboards.
Jeff

Thanks Glyn,
Just for personal development, how would I “unlock” the file system in
winSCP ?
Jeff

You would probably need to use the “remote command” feature of WINSCP

https://winscp.net/eng/docs/remote_command

then use that to run “rpi-rw” command

Thanks Stuart,
Will give that a go tonight.

OK…I’m still struggling with winSCP. I keep getting error code 3 and 4. I assume it is a permission issue. I tried remote command and set to rpi-rw. At my own risk is it possible to get root password or reset user:pi ? I just want to move files back and forth from my PC to PI and edit config files etc.

You would need to set up a root password for the root user, by default the root user password is disabled and now you mention it, I recall having to set up a root password when using winSCP in the past, some time ago now so I do not recall all the detail.

Although a quick search of the old forum turned up this thread Not updated inputs after update to 8.0.9 | Archived Forum and about half way though I explain how I did it, you can search the page for winscp to locate easily.

Ok…Now I’m feeling stupid! I followed the instructions using putty and it accepted new password.
sudo passwd
When I log out and back in with root:“newpassword” I get permission denied. I tried over 10 times…no luck with putty or winscp. Problem between keyboard and seat ??

Copied from the archived forum thread

I had never used WinSCP before today I have just tried it to recreate your issue and found it really quite good, I found the same situation and the solution is to enable a root user.

In normal use a raspberry pi user can get temporary root access by prefixing command with “sudo” WinSCP isn’t able to prefix command to get root access, You can however log in as “root” if you set up the root user password on pi first.

sudo passwd

enter a password and confirm.

You can now open a session in WinSCP logging into pi using the username root and the password you just set up.

(SSH & normal logging in as your usual user (pi) and using sudo will still work exactly as as before.)

To revoke this additional “root” user, whilst logged in as your usual user (pi)

sudo passwd -l root

and all is back as it was :slight_smile:

Have you used rpi-rw before setting the root password?

rpi-rw
sudo passwd

You say the password is “accepted” and I would expect it to complain if it cannot write to the password file, daft question but just to confirm, you’re not entering the sudo passwd -l root are you? That instruction is to undo the setting of a root password if/when it is no longer required.

Hi Paul,
This is what I got changing root password

    [email protected](ro):~$ rpi-rw
    Filesystem is unlocked - Write access
    type ' rpi-ro ' to lock
    [email protected](rw):~$ sudo passwd
    Enter new UNIX password:
    Retype new UNIX password:
    passwd: password updated successfully
    [email protected](rw):~$

Logged out and back in

    login as: root
    [email protected]'s password:
    Access denied
    [email protected]'s password:
    Access denied
    [email protected]'s password:
    Access denied
    [email protected]'s password:

Jeff

Does the root account on the Pi allow SSH access by default? You may need to set that up.

[Edit] - Didn’t think so ssh - How to login as root remotely? - Raspberry Pi Stack Exchange for solution

Edit2] - Have you tried running an SSH terminal session - changing file system to RW and then using SCP? Not sure if the script is session/user dependent.

1 Like

Ah yes! My last play with winSCP was in the Wheezy days and PermitRootLogin yes would have already been set. In Jessie the sshd config file will need editing to allow root login with a password, the default is now without-password to further encourage the use of pre-shared keys (if the root account login/password is enabled) rather than leaving yourself open to brute force attacks.

sudo nano /etc/ssh/sshd_config

and edit the PermitRootLogin without-password line to PermitRootLogin yes and restart the ssh service with

sudo service ssh restart

Thanks Paul,
That solved it…all good now
Jeff