Sudo and startup script
The right /etc/sudoers
configuration to prevent prompting for password is:
myusername ALL = NOPASSWD: /home/scriptname, /sbin/modprobe lib80211, /sbin/insmod /home/pitto/Drivers/broadcom/wl.ko
Related videos on Youtube
Pitto
Updated on September 17, 2022Comments
-
Pitto over 1 year
I have a new asus 1215n and I need to digit commands to enable multitouch. No problem: I've made a script. Since this netbook also need manual activation of the wifi driver the complete script is:
#!/bin/bash # # list of synaptics device properties http://www.x.org/archive/X11R7.5/doc/man/man4/synaptics.4.html#sect4 # list current synaptics device properties: xinput list-props '"SynPS/2 Synaptics TouchPad"' # sleep 5 #added delay... xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 8 1 xinput --set-prop --type=int --format=32 "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Pressure" 4 xinput --set-prop --type=int --format=32 "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Width" 9 # Below width 1 finger touch, above width simulate 2 finger touch. - value=pad-pixels xinput --set-prop --type=int --format=8 "SynPS/2 Synaptics TouchPad" "Synaptics Edge Scrolling" 1 1 0 # vertical, horizontal, corner - values: 0=disable 1=enable xinput --set-prop --type=int --format=32 "SynPS/2 Synaptics TouchPad" "Synaptics Jumpy Cursor Threshold" 250 # stabilize 2 finger actions - value=pad-pixels #xinput --set-prop --type=int --format=8 "SynPS/2 Synaptics TouchPad" "Synaptics Tap Action" 0 0 0 0 1 2 3 # pad corners rt rb lt lb tap fingers 1 2 3 (can't simulate more then 2 tap fingers AFAIK) - values: 0=disable 1=left 2=middle 3=right etc. (in FF 8=back 9=forward) xinput --set-prop --type=int --format=8 "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Scrolling" 1 0 # vertical scrolling, horizontal scrolling - values: 0=disable 1=enable #xinput --set-prop --type=int --format=8 "SynPS/2 Synaptics TouchPad" "Synaptics Circular Scrolling" 1 #xinput --set-prop --type=int --format=8 "SynPS/2 Synaptics TouchPad" "Synaptics Circular Scrolling Trigger" 3 sudo modprobe lib80211 sudo insmod /home/pitto/Drivers/broadcom/wl.ko exit
I've saved the script, then put it in my home, then
chmod +x scriptname
and then added it to startup applications.
Then I did:
sudo visudo
and added this row:myusername ALL=(ALL) NOPASSWD: /home/scriptname
rebooted and...
Multitouch works but wifi not. When I manually launch the script it asks for sudo password so I thought it was because of modprobe and insmod commands and I've added those commands to sudo visudo. Nothing.
What am I doing wrong?
-
João Pinto over 13 yearsThe modprobe / insmod commands should be placed into /etc/rc.local without sudo (rc.local is invoked during startup, with root).
-
danizmax over 13 yearsDid you check dmesg for any errors regarding wifi?
-
Pitto over 13 yearsThank you mates... /etc/rc.local did the trick! Absolutely no error regarding wifi: if I insert the sudo password it works great but I would like it to work without inserting password
-
Pitto over 13 yearsThanks Stefano for editing! If you teach me the right tag to send scripts I'll do better next time :)
-
oKtosiTe over 13 yearsIf you use the ``` character before and after a piece of text, it will be formatted as code. For longer code snippet, simply make sure they're indented with at least four spaces. For more information have a look at the editing help. @Pitto
-
Pitto over 13 yearsNo backtick on Italian keyboard... I'll copy/paste it... Thanks :)
-
-
Pitto over 13 yearsI've corrected it but it keeps asking me the password :/
-
Anmol over 13 yearsYou have to add the
/sbin/modprobe
and/sbin/insmod
applications to theNOPASSWD
line in/etc/sudoers
too. It would be a security risk otherwise.