LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook
User Name
Password
Linux - Laptop and Netbook Having a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).

Notices


Reply
  Search this Thread
Old 09-18-2004, 03:10 PM   #1
deathkrush
LQ Newbie
 
Registered: Sep 2004
Posts: 15

Rep: Reputation: 0
How to execute a script after standby/resume?


I have SuSe 9.1 installed on IBM Thinkpad T41 and I'm using powersave and apm for power management. Whenever I do standby/resume the wireless card, cisco vpn client, thinkpad buttons (tpb) and vmware modules get broken so I have to restart those. Basically each time I resume the laptop from a standby I have to type in a lot of commands:

su
<password>
rmmod ipw2200
modprobe ipw2200
ifdown eth1
ifup eth1
/etc/init.d/vpnclient_init restart
/etc/init.d/vmware restart
su stan --command="tpb &"

I wrote a script to do just that, so all I have to do is launch the script and type in the root password. Is there a way to launch the script automatically every time I resume the laptop from standby? I find it inconvenient and insecure to type in root password every day 24/7, I use the laptop in a classrom and I always have people looking over my shoulder gazing at my beautiful KDE desktop.
 
Old 09-23-2004, 03:12 PM   #2
deathkrush
LQ Newbie
 
Registered: Sep 2004
Posts: 15

Original Poster
Rep: Reputation: 0
Let me ask an easier question: is there any way to execute a script as root without typing the root password?
 
Old 09-23-2004, 03:27 PM   #3
amyloid
LQ Newbie
 
Registered: Sep 2004
Distribution: Debian
Posts: 10

Rep: Reputation: 0
use sudo
 
Old 09-23-2004, 04:18 PM   #4
deathkrush
LQ Newbie
 
Registered: Sep 2004
Posts: 15

Original Poster
Rep: Reputation: 0
I added the following to /etc/sudoers
stan ALL=(ALL) NOPASSWD: ALL
but that allows user stan to execute anything as root which is very insecure

How do I specify that user stan can only execute one command with no password?
 
Old 09-23-2004, 04:43 PM   #5
amyloid
LQ Newbie
 
Registered: Sep 2004
Distribution: Debian
Posts: 10

Rep: Reputation: 0
man sudoers

This should do what you want


stan ALL = NOPASSWD: /pathtocommand/command
 
Old 09-25-2004, 02:00 AM   #6
deathkrush
LQ Newbie
 
Registered: Sep 2004
Posts: 15

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by amyloid
man sudoers

This should do what you want


stan ALL = NOPASSWD: /pathtocommand/command
Thanks a lot!!! It works like a charm!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
execute a script upon logon Starch Linux - Newbie 3 05-12-2005 04:04 PM
Unable to resume from standby 12Iceman Linux - Newbie 3 03-24-2005 04:10 PM
Cannot execute a script grueugene Programming 15 01-27-2005 04:50 AM
Resume from standby is not working in Suse9.1 m@ra Linux - Laptop and Netbook 1 09-23-2004 11:54 AM
Why cant i execute a perl script dude4you Linux - Newbie 2 03-02-2004 05:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook

All times are GMT -5. The time now is 12:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration