Permission denied (openhab2, winSCP)

I’m using WinSCP to upload and download files to my openhab2 (#743) on a raspberry pi 3.

Becaus I’ve had problems I copied a backup-image-file on the sd-card of my pi and after booting I did a complete system update. (with openhabian-config, Options 01, 02, 03, 04 and 05)
System is up and running, but now I get the error message “permission denied” when I try to upload and override files on the raspberry pi.
Edit picture

I searched the forum and found some topics, but I’m afraid, that I open a security issiue, when I do settings, that I don’t understand exactliy.
Can someone explain me, how I have to setup the permissions to get this done? Thanks!

This is an operating system level issue. Are you using openHABian?

Thank for your reply.
Yes I’m using openhabian.

The WinSCP settings (for me anyway) are different depending if you manually installed or use OpenHABian.

First use the SCP protocol. For manual installation you need to select Advanced, SCP/Shell and select the ‘sudo su -’ option. For OpenHABian the SCP/Shell needs to be set to ‘default’.

Hope this helps

1 Like

Changed the protocol from sftp to scp, SCP/Shell is default.
But unfortunatly now I get this error:

Edit: Picture added

Did I miss something?

Your WinSCP screenshot above is the same as mine. Have just tried again using a spare sd card and it works fine.

  1. Copy openHABian image to sd card
  2. Insert into Raspberry Pi3 and switch on
  3. Wait an hour
  4. Check Openhab is working
  5. Run WinSCP, select new site, select SCP, enter ip address, pi and password and it allows me to upload files

Sorry I can’t help more with your error.

Nevertheless many thanks.

I got the same error as you this morning when trying to copy my Openhab files using WinSCP.

I have found that sometimes when I am trying to overwrite a file that is already there, you get the error. By deleting the file on the Rspberry Pi first you are then able to copy the new file across without error. It is not as if Openhab is using the file, it occurs on the readme.txt files also.

Also using Putty it is asking for a password when you carry out sudo commands. This doesn’t occur if you install via apt-get.

Strange…

1 Like

I’m new at this but taking a look at your screen shot, in winscp where it said she’ll: you can push the drop down and select sudo su-. This should give you rights to change files.
Hopes this helps.

The spell check put she’ll and I mint shell: . You have standard in yours. Click the drop down arrow to the right and select sudo su-.

I tried this before. That didn’t work. I couldn’t connect. I got the following error-message:

Thank you for your suggestion.

I have solved my problem. I initially uploaded my files (home.items etc.) via explorer using the Samba network ‘drive’.This creates them on the Raspberry Pi as user ‘openhab’.

When I tried to overwrite these using WinSCP I got a ‘permission denied’ error. I hadn’t initially noticed however that despite getting the error the file was actually updated.

To remove this error I deleted the configuration files and uploaded via WinSCP, where they are created as user pi.

Have never understood users and permissions :slight_smile:

Me too.

I’ll try your suggestion.

I’m not clear on permissions too.
The power was disconnected to my Pi3 running openHabian and now I cannot access config files via winSCP.

The window I get states:

General failure (server should provide error description).
Error code: 4
Error message from server: Failure

Common reasons for the Error code 4 are:

  • Renaming a file to a name of already existing file.
  • Creating a directory that already exists.

So, How to I get my write/delete permissions back?

Is there a thread that explains it clearly without assuming too much?

Thanks!

Hey guys,
not having permissions to do something is a pretty normal situation. The solution is always the same: Check the active permissions, then correct or work around them.

  1. Which user are you accessing the system with?
  2. Who is the file/folder you are trying to access owned by?
  3. Does your user have the correct permissions to read and/or write the location you are interested in?

With the latest revision of openHABian all you should need to do in order to be allowed to write to /etc/openhab2 and /var/lib/openhab2 is execute “Fix Permissions” from inside the openHABian Configuration Tool, so be sure to do that first.
You can by the way work easier by mounting the samba share, no need for winSCP in a local network. Check out the new “openHAB-share” share, you’ll like it.

Also remember that it’s totally normal that the main user doesn’t have permissions to do everything. That would be a security concern and that’s what sudo is for. You can copy files to the users home for example, then move them via SSH and mv. be sure to fix permissions afterwards, so openHAB can write to the files…

Tutorial: https://www.digitalocean.com/community/tutorials/an-introduction-to-linux-permissions

Yes, I can confirm, that after my last complete installation with openhabian everything is fine.
Option basic setup, and samba did it. Now I’m able to access/edit the oh2-files on my RPi by openhab-designer on my win10-pc.

@ThomDietrich Thanks!

Hey guys,
not having permissions to do something is a pretty normal situation. The solution is always the same: Check the active permissions, then correct or work around them.

@ThomDietrich. Thank you for your help. I’m not sure what went wrong but I couldn’t access openHab any way I tried and nothing worked either but when I hooked up directly to a monitor, it said that things were locked up and there were errors. (There was too much to copy down),
Anyway, I decided to re-install instead , if only to see whether stuff was backed up properly. I also set it up to run from a USB stick and I have access through Samba.
I need to check the forum though as fairly basic stuff doesn’t seem to be working such as installing bindings from the PaperUI (it just hour-glasses but going out of PaperUI and back in shows the binding has installed.