LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-16-2016, 12:37 PM   #1
Johnny_Metal
Member
 
Registered: Feb 2016
Posts: 72

Rep: Reputation: 1
Startup/Permanent permission change


Hello everyone,

This file

Quote:
/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/backlight/acpi_video0/brightness
is owned by root. I can change the permissions or the owner through the use of chmod or chown commands, but it happens that the changes aren't permanent, and every time I reboot my machine the permissions default to how they were before.

I need to either change the permission for this file permanently or create a script that automatically changes the file permissions at every session startup. I am using the Openbox Window Manager, so i know where the autostart file is.

Any ideas?

Last edited by Johnny_Metal; 05-16-2016 at 12:39 PM.
 
Old 05-16-2016, 01:25 PM   #2
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Instead of doing that, why not use visudo for this. Something like:
Code:
Johnny_Metal ALL=NOPASSWD: /path/to/your/program /sys/class/backlight/acpi_video0/brightness
There is a reason those permissions are what they are I presume. I personally wouldn't mess around with them.

Best regards,
HMW

Edit: For instance, I found it annoying to type the password every time I use the wifi-menu on my Arch Linux machine, so I added this at the END of my visudo configuration:
Code:
## Allow group sudo to run wifi-menu without password
%sudo   ALL=(ALL) NOPASSWD: /usr/bin/wifi-menu

Last edited by HMW; 05-16-2016 at 02:17 PM.
 
Old 05-16-2016, 04:16 PM   #3
Johnny_Metal
Member
 
Registered: Feb 2016
Posts: 72

Original Poster
Rep: Reputation: 1
I've tried out what you told me, but the syntax doesn't work in that way.

From what i've understood, i can post the path to a certain executable. However, my programs aren't allowed to make their changes. I tried adding the following lines for that effect


Code:
jr ALL=NOPASSWD: /home/jr/Brightness_Settings/bup.out
jr ALL=NOPASSWD: /home/jr/Brightness_Settings/bdown.out
It's funny though, because if I simply run them from a terminal window with the sudo command, they work!

I also tried using the scripts you suggested. They work absolutely fine from a terminal, no need for sudo command. Here's the contents i've added to the sudoers and one of the scripts (the other simply differs because it has a - instead of a +)

Code:
jr ALL=NOPASSWD: /home/jr/Brightness_Settings/brightness_up.sh
jr ALL=NOPASSWD: /home/jr/Brightness_Settings/brightness_down.sh
Code:
currentValue=$(cat /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/backlight/acpi_video0/brightness)
sudo tee /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/backlight/acpi_video0/brightness <<< $((currentValue+2))
However, after adding the path of the scripts to the rc.xml file and reconfiguring OpenBox, it still doesn't work! Here's what the keybinds look like:

Quote:
<keybind key="C-Up">
<action name="Execute">
<command>/home/jr/Brightness_Settings/brightness_up.sh</command>
</action>
</keybind>
<keybind key="C-Down">
<action name="Execute">
<command>/home/jr/Brightness_Settings/brightness_down.sh</command>
</action>
</keybind>
Really appreciated for your help.

EDIT
It ocurred to me that it might somehow be necessary to edit the permissions of the rc.xml file itself... is it possible?

EDIT
Found it out: just need to write the keybinds, whether for the scripts or the my programs together with the sudo command. Together with the permissions, they work just fine.

Thanks a lot for your hep throughout the day!

Last edited by Johnny_Metal; 05-16-2016 at 04:51 PM.
 
Old 05-17-2016, 01:56 AM   #4
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Quote:
Originally Posted by Johnny_Metal View Post
EDIT
Found it out: just need to write the keybinds, whether for the scripts or the my programs together with the sudo command. Together with the permissions, they work just fine.

Thanks a lot for your hep throughout the day!
Awesome. Good work buddy! I took the liberty of highlighting your quote above so that others can find the solution easier.

Best regards,
HMW
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to permanent change permission of a file? MODYSAMA Linux - Newbie 7 06-08-2011 09:05 AM
SU-prompt permanent on Suse 10.1 KDE 3.5 at startup botia SUSE / openSUSE 6 05-03-2006 04:15 PM
FSTAB and /mnt/windows permission problems. Changes are not permanent? Maxei Linux - General 7 11-05-2005 08:42 PM
set permanent read-write permission on shares Randall Slack Linux - Networking 1 10-30-2005 08:54 PM
Permanent verbose mode for startup Fnurr Mandriva 4 02-07-2005 03:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration