LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-25-2013, 04:56 AM   #1
m_kane
Member
 
Registered: Jan 2009
Posts: 31

Rep: Reputation: 2
Restart network service as user - Opensuse 12.1


Hi,

I have problem, where network fails to work after suspending machine. This happens very rarely, but is difficult to handle, because it is difficult to access terminal etc when network is down. Don't know why, but I can't even open terminal window in that state (application launcher is freezed too). I think this is caused by my nfs shares what are down and system tries to access them.

Anyway, I can recover when I restart networking service. But how can this be done automatically when machine wakes up from suspend? I have script what runs when I suspend machine. It sets kopete offline and after suspend to online. Also it sets alsamixer volume. But I can't add network restart command to it, because it runs as user rights, not as root.

So,
- Can I allow my user account right to restart networking service without password? To run it in suspend script?
- Or can restart command set to run automatically when system restores from suspend?

I tried to add this to sudoers:
myusername ALL = /etc/init.d/network
myusername ALL=(root) /sbin/service

But I can't still restart service without sudo command and password.
 
Old 04-25-2013, 06:38 AM   #2
m_kane
Member
 
Registered: Jan 2009
Posts: 31

Original Poster
Rep: Reputation: 2
Ok,

I found a solution, maybe not a fine one, but working:

Added this to sudoers file:

myusername ALL= NOPASSWD: /sbin/service


now I can add "sudo /sbin/service network restart" to my wakeup script, and it doesnot ask for password.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
service network restart - interface RMLinux Red Hat 2 09-08-2008 11:16 PM
what is the difference between service network reload and service network restart ? markraem Linux - Networking 3 11-21-2007 04:08 PM
In FC6 network interface doesn't come up if 'service network restart' command is run rajat Linux - Networking 2 05-03-2007 12:53 AM
How do I set the regulatory daemon to restart when I restart the network service? zahadumy Linux - Networking 0 11-05-2006 12:24 PM
service network restart perry Linux - Networking 2 12-15-2003 08:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:55 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