The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > OS X (Apple)
Google UNIX.COM


OS X (Apple) OS X is a line of Unix-based graphical operating systems developed, marketed, and sold by Apple.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Change IP Adress magasem HP-UX 1 08-26-2006 07:13 PM
How to change the MAC adress in ethernet adapter for SUN mono673 UNIX for Dummies Questions & Answers 1 02-08-2006 09:46 AM
Capture IP Adress pascalbout AIX 14 01-30-2006 07:51 AM
IP-Adress MuellerUrs SUN Solaris 1 09-30-2005 08:15 AM
MAC-Adress nkochr UNIX for Dummies Questions & Answers 2 09-26-2001 08:16 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-04-2008
Registered User
 

Join Date: Jun 2008
Posts: 3
Stumble this Post!
Obtain Mac Adress in crontab

hello,

I need to obtain the Mac Adress and write him in a file.
I'm trying to do this with a command in crontab, with ifconfig, but it's only possible do this if i disabled the password for run the command, but than i have security problems.
I'm searching for a script (.sh) that allows me to do that, in crontab, without those problems. Is it possible? Thus anyone have a sript to do this?

Thanks,
Pedro
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 06-04-2008
Registered User
 

Join Date: May 2008
Posts: 64
Stumble this Post!
Quote:
Originally Posted by Pedro Almeida View Post
hello,

I need to obtain the Mac Adress and write him in a file.
I'm trying to do this with a command in crontab, with ifconfig, but it's only possible do this if i disabled the password for run the command, but than (sp) i have security problems.
I'm searching for a script (.sh) that allows me to do that, in crontab, without those problems. Is it possible? Thus anyone have a sript to do this?

Thanks,
Pedro
Try researching sudo for Mac OS
Reply With Quote
  #3 (permalink)  
Old 06-05-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
Stumble this Post!
If you have sudo permissions, you can add the command to root's crontab.
Reply With Quote
  #4 (permalink)  
Old 06-06-2008
Registered User
 

Join Date: Jun 2008
Posts: 3
Stumble this Post!
Quote:
Originally Posted by era View Post
If you have sudo permissions, you can add the command to root's crontab.
Thanks era,

I'm not an expertise in MAC OSX. Can you help me? Can you show me the command line that i can use in the crontab? At this momment I have the sudoers file configured to not ask for password, but i want to put him asking for the password.
The objective is to put Mac Adress in a file txt during the reboot process, without human intervention.

Thanks for your help.
Pedro Almeida
Reply With Quote
  #5 (permalink)  
Old 06-06-2008
Registered User
 

Join Date: Jun 2008
Posts: 3
Stumble this Post!
I have found this:

NOPASSWD and PASSWD
By default, sudo requires that a user authenticate him or herself before running a command. This behavior can be modified via the NOPASSWD tag. Like a Runas_Spec, the NOPASSWD tag sets a default for the commands that follow it in the Cmnd_Spec_List. Conversely, the PASSWD tag can be used to reverse things. For example:

ray rushmore = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprmwould allow the user ray to run /bin/kill, /bin/ls, and /usr/bin/lprm as root on the machine rushmore as root without authenticating himself. If we only want ray to be able to run /bin/kill without a password the entry would be:

ray rushmore = NOPASSWD: /bin/kill, PASSWD: /bin/ls, /usr/bin/lprmNote, however, that the PASSWD tag has no effect on users who are in the group specified by the exempt_group option.

By default, if the NOPASSWD tag is applied to any of the entries for a user on the current host, he or she will be able to run sudo -l without a password. Additionally, a user may only run sudo -v without a password if the NOPASSWD tag is present for all a user's entries that pertain to the current host. This behavior may be overridden via the verifypw and listpw options.



My question is: Can I exclude just one command from the need of Password for all users? I'm using something like this
ifconfig en1 | grep ether >> /something/MacAdress.txt

Thanks
PA
Reply With Quote
  #6 (permalink)  
Old 06-06-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
Stumble this Post!
Why don't you just run that command as root during the boot process? I'm not particularly familiar with Mac OS X either, so how exactly to do that is not my table, but in general, just add a small init script in your local equivalent of /etc/init.d/rc.local or similar.

Do you really expect your MAC address to change between reboots ...?
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:15 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0