You are not logged in.

#1 2012-02-02 19:26:22

dabbi2000
Member
From: Reykjavik, Iceland
Registered: 2011-09-28
Posts: 119
Website

[SOLVED] What visudo change for echo-ing a system parameter?

according to Wiki, backlight can be set by

 echo 5 > /sys/class/backlight/acpi_video0/brightness

but only as root. What change to do with visudo to allow user to set value?

Last edited by dabbi2000 (2012-02-03 08:13:22)

Offline

#2 2012-02-02 19:46:09

rscholer
Member
From: Gelsenkirchen, Germany
Registered: 2008-07-03
Posts: 48

Re: [SOLVED] What visudo change for echo-ing a system parameter?

You need to run the following command:

echo 5 | sudo tee /sys/class/backlight/acpi_video0/brightness

or

sudo bash -c "echo 5 > /sys/class/backlight/acpi_video0/brightness"

Offline

#3 2012-02-02 19:56:37

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: [SOLVED] What visudo change for echo-ing a system parameter?

The standard way to do that using sudo would be with tee.  But you certainly don't want to grant special permissions to tee.  I think you would need to create a script:

#!/bin/bash
echo 5 > /sys/class/backlight/acpi_video0/brightness

Store it in /usr/bin, make it writable by root only, and configure sudoers to allow this script.

Keep in mind I'm no security guru.  There may be serious considerations with this method that I'm not aware of.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#4 2012-02-03 08:13:12

dabbi2000
Member
From: Reykjavik, Iceland
Registered: 2011-09-28
Posts: 119
Website

Re: [SOLVED] What visudo change for echo-ing a system parameter?

thx everyone, I will go with the /usr/bin script way since I want to refrain from installing sudo

Offline

#5 2012-02-03 15:33:17

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: [SOLVED] What visudo change for echo-ing a system parameter?

You need sudo to use the script method as I described it.  The idea is to put a line in sudoers allowing the average user to use sudo only with the script:

%users <hostname>=(ALL) /usr/bin/<scriptname>

However, you could probably also make the script setuid.

It bears repeating that I am no security expert and you should take my suggestions with a grain truckload of salt.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#6 2012-02-03 16:01:50

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: [SOLVED] What visudo change for echo-ing a system parameter?

dabbi2000 wrote:

I want to refrain from installing sudo

Then why are you talking about using visudo?

Offline

#7 2012-02-04 07:23:18

dabbi2000
Member
From: Reykjavik, Iceland
Registered: 2011-09-28
Posts: 119
Website

Re: [SOLVED] What visudo change for echo-ing a system parameter?

visudo changes the /etc/sudoers file, sudo is a whole different thing!

Offline

#8 2012-02-04 10:23:28

Gusar
Member
Registered: 2009-08-25
Posts: 3,607

Re: [SOLVED] What visudo change for echo-ing a system parameter?

dabbi2000 wrote:

visudo changes the /etc/sudoers file, sudo is a whole different thing!

Let me ask you a question: Which app do you think is the most likely candidate to be using the /etc/sudoers file?

Offline

#9 2012-02-04 11:15:43

dabbi2000
Member
From: Reykjavik, Iceland
Registered: 2011-09-28
Posts: 119
Website

Re: [SOLVED] What visudo change for echo-ing a system parameter?

ok, got it. sudo uses /etc/sudoers. Thought it was a symlink hack of somekind, stupid me. Still I think I am correct that using sudoers directly is the more correct Arch way, doing it manually...

Offline

#10 2012-02-04 17:05:59

rwd
Member
Registered: 2009-02-08
Posts: 671

Re: [SOLVED] What visudo change for echo-ing a system parameter?

you could solve it with permissions. In /etc/rc.local put :

chmod  go+rw /sys/class/backlight/acpi_video0/brightness

Offline

#11 2012-02-05 07:00:15

dabbi2000
Member
From: Reykjavik, Iceland
Registered: 2011-09-28
Posts: 119
Website

Re: [SOLVED] What visudo change for echo-ing a system parameter?

thx rwd, your suggestion works like a charm, feels better than editing the sudoers file

Last edited by dabbi2000 (2012-02-05 07:22:12)

Offline

Board footer

Powered by FluxBB