LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-04-2012, 10:15 AM   #1
oneindelijk
Member
 
Registered: Oct 2012
Location: Belgium
Distribution: Xubuntu
Posts: 32

Rep: Reputation: Disabled
Running sudo commands from a script


Hi,

I'm trying to start airmon-ng and airodump-ng from a script, but it won't run without elevated privileges.
I need this to automatically start wireshark on the same channel as a router is configured.
All the systems are on a separate test-network where security is not an issue nor need my scripts to be portable.
Can I simply chmod the scripts from aircrack-ng to execute for any user ?
Or is there a better way that is not anymore complicated than this ?

kind regards
 
Old 12-04-2012, 10:28 AM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Just start the script with sudo.
 
Old 12-04-2012, 10:29 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by oneindelijk View Post
Hi,
I'm trying to start airmon-ng and airodump-ng from a script, but it won't run without elevated privileges.
I need this to automatically start wireshark on the same channel as a router is configured.
All the systems are on a separate test-network where security is not an issue nor need my scripts to be portable.
Can I simply chmod the scripts from aircrack-ng to execute for any user ?
Or is there a better way that is not anymore complicated than this ?
kind regards
Not sure what the problem is. Just putting "sudo" in front of a command in a script will let it work with root/elevated privileges. If you put the NOPASSWD directive into the sudoers file for a user/group, that does it.
 
Old 12-04-2012, 11:37 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Moved: This thread is more suitable in the Linux Newbie forum (your question isn't related to Linux Security) and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 12-11-2012, 02:42 AM   #5
oneindelijk
Member
 
Registered: Oct 2012
Location: Belgium
Distribution: Xubuntu
Posts: 32

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
Not sure what the problem is. Just putting "sudo" in front of a command in a script will let it work with root/elevated privileges. If you put the NOPASSWD directive into the sudoers file for a user/group, that does it.
Hi,

I found this solution in another thread. I also put the user in the 'sudo' group. I don't know if that was unnecessary, I'm just mentioning it...
Thanks anyway
 
  


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
Getting libusb permission errors running sudo commands SaintDanBert Linux - Security 22 07-05-2012 03:13 AM
[SOLVED] bash - script not see environment variable running under sudo jfjh201 Linux - Software 1 06-16-2012 06:34 AM
Issue in running commands in expect script from shell script yadvinder Programming 0 05-31-2012 04:07 AM
Displayign what user is running sudo commands jakev383 Linux - Security 1 08-04-2009 03:01 PM
ubuntu - running sudo shell script from php mitilma Linux - Security 3 06-14-2007 01:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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