You are not logged in.
I use the following alias in my .bashrc.
alias br='sudo tee /sys/class/backlight/intel_backlight/brightness <<<'
ex:
$ br 200
I would like to make it available without root permission though.
Maybe change it so that it's root-free to a certain extent (up to 400 for example).
Thank you for reading.
Greetings from Germany.
Offline
$ pacman -S xorg-xbacklightYou can try this as a non-root alternative.
Personal spot :: https://www.smirky.net/ :: Try not to get lost!
Offline
I had an indicator on my desktop for a while, displaying the HDD temperature, but the hddtemp command requires root, so I have this line in my /etc/sudoers file:
tom ALL=(ALL) NOPASSWD: /usr/bin/hddtempYou could move the br alias into a script, alias br='/location/of/script', and add the script to the sudoers file as above. Probably a good idea to make the script owned by root for security.
The script could handle the cases where it's over 400.
Last edited by rin (2014-10-05 17:39:38)
Offline
Welcome to Arch Linux
Interesting idea. You might get it to work by creating a sudoers rule to allow anyone to run a particular script. Then, write that as a script rather then an alias. Or, do it in a compiled language and set the usid bit. It won't work for scripts though.
edit: Rin, Sorry, I did miss your bit about sudoers, or did you edit your post at the same time I was posting?![]()
Last edited by ewaller (2014-10-05 19:25:15)
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
you can use an udev rule to change permissions of a particular device or property of a device. I use this for a macbook for example:
ACTION=="add", KERNEL=="apple_backlight", SUBSYSTEM=="backlight", RUN+="/usr/bin/chmod 0666 /sys/class/backlight/%k/brightness /sys/class/backlight/%k/bl_power"Offline
@rwd
Well that's for a device, less for a subsequent command.
do it good first, it will be faster than do it twice the saint ![]()
Offline
Maybe I misread Archizzle's question. But if the goal is to let a non privileged user write/read to a device then that udev rule makes it so. In that case the command can get rid of 'sudo'.
Offline
the command can get rid of 'sudo'.
As above mentioned we may get rid of sudo when setting an appropriated rule in /etc/sudoers.d/, too ![]()
do it good first, it will be faster than do it twice the saint ![]()
Offline
rwd wrote:the command can get rid of 'sudo'.
As above mentioned we may get rid of sudo when setting an appropriated rule in /etc/sudoers.d/, too
It is just a different way to achieve the same goal. I personally don't like giving scripts root privileges, with setuid/setguid or sudoers because it may lead to privilege escalation in case of bugs in the script, but that may just be me being a bit too cautious.
Last edited by rwd (2014-10-08 08:51:23)
Offline
TheSaint wrote:rwd wrote:the command can get rid of 'sudo'.
As above mentioned we may get rid of sudo when setting an appropriated rule in /etc/sudoers.d/, too
It is just a different way to achieve the same goal. I personally don't like giving scripts root privileges, with setuid/setguid or sudoers because it may lead to privilege escalation in case of bugs in the script, but that may just be me being a bit too cautious.
Just a note, setuid/setgid does not work with scripts by design. It does work with compiled binaries. Scripts do work with sudo.
OP. How about creating a new group, adding the desired users to that group, change the group of the programs in question to that group, turn on group execute and turn off world execute for those programs.
That, or ACLs.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline