sudo without having to type a password

Forum rules
Before you post please read this

sudo without having to type a password

Postby lilcreep on Wed Jan 11, 2012 4:39 pm

Hi,

my notebook with hybrid graphics starts with on-chip-graphics in use, but both graphic chips powered.
To safe battery power, I want to use a script, executed on startup:

Code: Select all
sudo -s
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
exit
exit


Problem is, that this script will ask for my user-password.
How can I do thatfully automatic, without any thing bugging me.
lilcreep
Level 1
Level 1
 
Posts: 3
Joined: Fri Dec 09, 2011 6:15 pm

Linux Mint is funded by ads and donations.
 

Re: sudo without having to type a password

Postby walcken on Wed Jan 11, 2012 4:50 pm

Try to put this line :

Code: Select all
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch


before the line

Code: Select all
exit 0


in the file at the following path : /etc/rc.local
walcken
Level 1
Level 1
 
Posts: 3
Joined: Mon Jan 09, 2012 7:51 pm

Re: sudo without having to type a password

Postby Habitual on Wed Jan 11, 2012 4:52 pm

/etc/rc.local
What's a landing but a take off in reverse?
User avatar
Habitual
Level 8
Level 8
 
Posts: 2213
Joined: Sun Nov 21, 2010 8:31 pm
Location: LM17Q-Xfce

Re: sudo without having to type a password

Postby Roken on Wed Jan 11, 2012 5:01 pm

You can run a command with sudo in a script if you want:
Code: Select all
echo "password" | sudo -S command
Kernel Linux Tex 3.2.2-1 (64 bit) xfce , burg
Arch
ATI Radeon HD 4670, 1GB
OSS4
AMD Phenom II X4 (965BE) @ 3.6 Ghz (Overclocked)
8Gb RAM
Image
User avatar
Roken
Level 5
Level 5
 
Posts: 747
Joined: Fri Nov 19, 2010 4:55 pm
Location: Oldham, UK

Re: sudo without having to type a password

Postby walcken on Wed Jan 11, 2012 8:46 pm

Habitual wrote:/etc/rc.local


That's exactly what I said :roll:
walcken
Level 1
Level 1
 
Posts: 3
Joined: Mon Jan 09, 2012 7:51 pm


Return to Scripts & Bash

Who is online

Users browsing this forum: BlackVeils and 2 guests