pducharme / UniFi-Video-Controller

Docker for Unifi-Video Controller (Ubiquiti Networks)
199 stars 105 forks source link

Permission denied? #53

Closed mikestecker closed 6 years ago

mikestecker commented 6 years ago

Sorry if this is a newbie docker question... I'm getting a Please correct permissions or ownership and try again. error when trying to save any settings under Settings -> System Configuration -> Configure. All I want to do is set time-based purging but I keep getting this error.

I'm running on Fedora Server Edition, using the PUID and PGID settings which translate to nobody and users group. I have confirmed that my recording path indeed has the proper permissions, I see new recording and can delete them from the Recordings tab but when I try and save these settings I get an error.

I'm also seeing this in my error log: 1516556256.660 2018-01-21 09:37:36.660/PST: ERROR rejectIfPathInvalid - ERROR: Incorrect Ownership /usr/lib/unifi-video/data/videos:root in tomcat-HTTP-exec-3

I have also tried changing these to another user but docker errors when trying to run with a different user, even with root!

Any suggestions on how to resolve this?

Here is my complete docker command: docker run --name unifi-video --cap-add SYS_ADMIN --cap-add DAC_READ_SEARCH -p 7442:7442 -p 7443:7443 -p 7445:7445 -p 7446:7446 -p 7447:7447 -p 7080:7080 -p 6666:6666 -v /var/lib/unifi-video:/var/lib/unifi-video -v /mnt/security/unifi-video/data/videos:/usr/lib/unifi-video/data/videos -v /var/log/unifi-video:/var/log/unifi-video -e TZ=America/Los_Angeles -e PUID=99 -e PGID=100 -e DEBUG=1 --restart unless-stopped pducharme/unifi-video-controller

Elehiggle commented 6 years ago

Same error here, no idea why it happens. I can't even change the video path to a local folder inside the Docker, it says wrong ownership. Weird thing is that when I provide a video path in the environment variable to /usr/lib/.. it changes the mounting point to a whole different path and I have no idea why lol.

Elehiggle commented 6 years ago

Also, the controller does not detect any of my cameras if not ran in host mode (eg. bridge does not work).

Apparently this docker does not like being run as root (as indicated by the log files adding ":root" behind the path). Running it as 99/100 worked for me. Make sure to let the docker create the folders for you or alternatively run: chown -R 99:100 YOUR_UNIFI_VIDEO_FOLDER

docker run \ -d \ --name unifivideo \ --cap-add SYS_ADMIN \ --cap-add DAC_READ_SEARCH \ --network=host \ -v /media/data/Docker/unifivideo/data:/var/lib/unifi-video \ -v /media/data/Docker/unifivideo/videos:/videos \ -v /media/data/Docker/unifivideo/logs:/var/log/unifi-video \ -e TZ=Europe/Berlin \ -e PUID=1000 \ -e PGID=1000 \ -e DEBUG=1 \ --security-opt apparmor:unconfined \ --cpus="2.0" \ pducharme/unifi-video-controller ; docker exec -it unifivideo /bin/bash -c "chown -R 1000:1000 /videos"

mvarrieur commented 6 years ago

I finally was able to get this working after many days of trying. On my NAS I had to create a user called unifi-video and a group called unifi-video with the IDs 99 and 100 respectively. Then I used the default PUID and PGID settings from this docker container, recreated the NVR container, and it was able to work. Just setting the PUID and PGID environment variables didn't seem to be enough.

I was able to /bin/bash into the docker container and verify the unifi-video user had the correct permissions, but something in the NVR software didn't like it when the user name didn't match up to what was on the chown'd directory. Making the chown'd name match up seemed to fix it for me at least.

fryfrog commented 6 years ago

@mikestecker, did you get this sorted out?

fryfrog commented 6 years ago

I'm gonna close this, feel free to come back for more help as needed.