Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Permission Woes
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
crookedmaze
n00b
n00b


Joined: 05 Jan 2013
Posts: 2

PostPosted: Sun Jan 06, 2013 3:15 pm    Post subject: Permission Woes Reply with quote

Hello fellow Gentoo Linux users! :D

I wasn't sure where to post so I decided to post here. I am having a bit of trouble (Permissions wise) with /sys/class/backlight/acpi_video0/brightness I wrote two scripts that change brightness one takes the value in /sys/class/backlight/acpi_video0/brightness and decrements it by 1 and the other one increments it when I use the fn + f5 (decrement) and fn + f6 (increment) keys. The problem is when I reboot the file permission is changed and the file is owned by root and the scripts don't work because they don't have permission. I tried making both of the scripts SUID and run as root but the script still fails unless I am in a root shell and run the script. I am thinking that maybe I could create a shell script that runs on startup and runs "sudo chown crookedmaze /sys/class/backlight/acpi_video0/brightness" but I am not sure how I should go about doing this or if this would be a viable solution to my problem.

To make the scripts SUID I did the following (perhaps I did something wrong here?)

Code:

(Normal_User)$ sudo /bin/bash
(Root)# chmod u+s /bin/dec_brightness (this is my script that decrements brightness)
(Root)# chmod u+s /bin/inc_brightness (this is my script that increments brightness)


This is the script that I use to decrease brightness
Code:

#!/bin/bash
#SCRIPT:  dec_brightness
#PURPOSE: Decrease Brightness

FILENAME=/sys/class/backlight/acpi_video0/brightness
value=$(sed -n '1p' $FILENAME)   
let value=$value-1
echo -n $value > /sys/class/backlight/acpi_video0/brightness


This is the script that I use to increase brightness
Code:

#!/bin/bash
#SCRIPT:  inc_brightness
#PURPOSE: Increase Brightness

FILENAME=/sys/class/backlight/acpi_video0/brightness

value=$(sed -n '1p' $FILENAME)   
let value=$value+1
echo -n $value > /sys/class/backlight/acpi_video0/brightness



Also I am using KDE4

Thank you for taking the time to read my post! :D

-Crookedmaze
_________________
The more I know the more I know I know nothing...
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Sun Jan 06, 2013 3:41 pm    Post subject: Re: Permission Woes Reply with quote

crookedmaze wrote:
make the scripts SUID

That doesn't work with BASH scripts.
Back to top
View user's profile Send private message
crookedmaze
n00b
n00b


Joined: 05 Jan 2013
Posts: 2

PostPosted: Sun Jan 06, 2013 5:01 pm    Post subject: Re: Permission Woes Reply with quote

PaulBredbury wrote:
crookedmaze wrote:
make the scripts SUID

That doesn't work with BASH scripts.


Ok, Thank you!
_________________
The more I know the more I know I know nothing...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum