LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   3 related questions on bash command usage. (https://www.linuxquestions.org/questions/linux-newbie-8/3-related-questions-on-bash-command-usage-780219/)

EricTRA 01-06-2010 05:43 AM

Hi,

That indeed is the sudoers file, but don't just edit it like that. You have to use:
Code:

sudo visudo
as a user in order to edit it. To check out if you are of the admin group (which I think you are if you're the only user, and since you can use sudo), type in a terminal as your user:
Code:

id
and it'll show you all the groups and ids assigned to your user.

Kind regards,

Eric

EricTRA 01-06-2010 05:46 AM

Also, what would be very useful to you is to look at the sudoers man page:
Code:

man sudoers
It's pretty extensive reading but I think worth the while. You can set a lot in the sudoers list.

Kind regards,

Eric

lupusarcanus 01-06-2010 05:47 AM

Quote:

Originally Posted by EricTRA (Post 3816044)
Hi,

That indeed is the sudoers file, but don't just edit it like that. You have to use:
Code:

sudo visudo
as a user in order to edit it. To check out if you are of the admin group (which I think you are if you're the only user, and since you can use sudo), type in a terminal as your user:
Code:

id
and it'll show you all the groups and ids assigned to your user.

Kind regards,

Eric

Hello once again Eric.

"id" returns:
Code:

andrew@mylinuxbox:~$ id
uid=1000(andrew) gid=1000(andrew) groups=4(adm),20(dialout),24(cdrom),46(plugdev),104(lpadmin),115(admin),120(sambashare),1000(andrew)


EricTRA 01-06-2010 05:48 AM

Quote:

Originally Posted by leopard (Post 3816041)
Hi. I re-did the file to those specifications, and it resulted in the said flashing of the terminal with no output or action. (It flashes very fast so I can't really see if anything happened but the command "airodump-ng" should result in sustained output)

Did you still leave a
Code:

sudo su
in your script? I think it's best to leave it out of the script and just use it like this:
Code:

sudo yourscriptname
Kind regards,

Eric

lupusarcanus 01-06-2010 06:03 AM

Thanks Eric!

That did the trick. I made a GNOME menu entry and used "gksudo /home/andrew/Desktop/airodump-ng_auto" (airodump-ng_auto was my script name) and it worked like a charm.

I attached a few screenshots of the script in action!

EricTRA 01-06-2010 06:05 AM

Hello Andrew,

Glad you got it running as you wanted. If you consider your thread as solved please mark it as such using the Thread Tools.

Kind regards,

Eric

lupusarcanus 01-06-2010 06:13 AM

Quote:

Originally Posted by EricTRA (Post 3816066)
Hello Andrew,

Glad you got it running as you wanted. If you consider your thread as solved please mark it as such using the Thread Tools.

Kind regards,

Eric

Sure did! It's in my sig! +3 Thank Icon clicks!

Here is the script that I used for future reference of this thread.

Code:

#! /bin/bash
service network-manager stop
ifconfig wlan0 down
iwconfig wlan0 mode monitor
ifconfig wlan0 up
airodump-ng wlan0


vrmartin2 01-06-2010 08:12 AM

&& vs ||
 
Also note that you join commands with && if you want to stop the sequence if any of the commands fail. "echo 1 && echo 2" means echo 1 and if that statement succeeds, then run the command "echo 2" and on and on any number of commands. On the other hand "echo 1 || echo 2" means run "echo 1" and then only if that fails, run "echo 2"

And if you really don't care what the return status is or the return status is undefined (unlikely on Linux but very prevalent in Windows) then just use the semicolon (";").

internetplayer 01-06-2010 08:55 AM

it looks great to me i am curious to know further.


All times are GMT -5. The time now is 08:19 PM.