Page 1 of 1

I can not change log folder permissions

Posted: Sat Feb 17, 2018 5:34 am
by mugurdi
Hello,
I installed Motion on my new Raspberry Pi. When I try to execute it by typing
motion -n
I get permission error in a log file. I try to change permissions, but I can not, nor using sudo. In my PC I have Mint 18, really the permissions are much easier using sudo.
What I can do?

(I'm connected to RPi by VNC (tightvncserver + tightvcn-jviewer in Mint 18 PC))

Code: Select all

pi@raspberrypi:/ $ motion -n
[0:motion] [NTC] [ALL] conf_load: Processing thread 0 - config file /etc/motion/motion.conf
[0:motion] [NTC] [ALL] config_camera: Processing camera config file /etc/motion/camera1.conf
[0:motion] [NTC] [ALL] motion_startup: Motion 4.0 Started
[0:motion] [ERR] [ALL] myfopen: Error opening file /var/log/motion/motion.log with mode a: Permission denied
[0:motion] [EMG] [ALL] motion_startup: Exit motion, cannot create log file /var/log/motion/motion.log: Permission denied

Code: Select all

pi@raspberrypi:/ $ sudo motion -n
sudo: /etc/sudoers is world writable
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

Code: Select all

pi@raspberrypi:/var $ sudo chmod 777 -R log
sudo: /etc/sudoers is world writable
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

Code: Select all

pi@raspberrypi:/var $ chmod 777 -R log
chmod: changing permissions of 'log': Operation not permitted
chmod: changing permissions of 'log/alternatives.log': Operation not permitted
chmod: changing permissions of 'log/lastlog': Operation not permitted
.............. etc ..............

Re: I can not change log folder permissions

Posted: Sat Feb 17, 2018 9:05 am
by jahboater
You should probably fix your sudoers file first.

Code: Select all

pi@pi3:/etc $ ls -l sudoers
-r--r----- 1 root root 669 Jun  5  2017 sudoers
pi@pi3:/etc $ 

Re: I can not change log folder permissions

Posted: Sun Feb 18, 2018 3:23 am
by mugurdi
Thanks for your answer.
I think I've found out the reason: once thinking about eliminating some permissions problem, I changed the permissions to the folder / etc
Now I have executed

Code: Select all

phexec chmod 0440 /etc/sudoers
And problem solved!