Obtain Mac Adress in crontab


 
Thread Tools Search this Thread
Operating Systems OS X (Apple) Obtain Mac Adress in crontab
# 1  
Old 06-04-2008
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
# 2  
Old 06-04-2008
Quote:
Originally Posted by Pedro Almeida
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
# 3  
Old 06-06-2008
If you have sudo permissions, you can add the command to root's crontab.
# 4  
Old 06-06-2008
Quote:
Originally Posted by era
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
# 5  
Old 06-06-2008
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
# 6  
Old 06-06-2008
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 ...?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

How to change IP adress of mailserver in Solaris?

Hi all, Our IT changes mailserver's IP address and I am trying to change it but with no success. I am running Solaris 10. I changed IP address of mail server in /etc/hosts file, performed make sendmail.cf but server still sends mais using old IP. Can anyone let me know which actions... (12 Replies)
Discussion started by: nypreH
12 Replies

2. IP Networking

adress traffic to tap0

Hello, I have a problem of routing traffic on two virtual interfaces I have created on my machine (CentOs6) By using tunctl I created two virtual interfaces tap1 and tap2 let s imagine I gave them two different address tap1: 10.1.1.1 net 255.255.255.0 tap2: 10.1.2.1 net 255.255.255.0 ... (0 Replies)
Discussion started by: nicandro
0 Replies

3. Shell Programming and Scripting

Trying to get an IP adress from a file

This is probably a real n00b question but i`m not able to figure it out. I have a folder of configuration files that contain IP-adresses. The line i`m interested in looks like this: IP_ADDRESS="123.123.123.1123" Some have muliple ip adresses, so the line will look like : ... (5 Replies)
Discussion started by: DaneV
5 Replies

4. IP Networking

Changing the Ip adress permanently

well i'm trying to change the ip adress on an old alphaserver runing tru64 4.0F using the ifconfig hme0 IP_ADDRESS mask MASK broadcast BROADCAST and when i check it using ifconfig -a it shows the new ip and all is well but when the server is rebooted it reverts back to the old ip (3 Replies)
Discussion started by: randUSR()
3 Replies

5. HP-UX

Change IP Adress

I want change my IP address and hostname in my machine by use the console. Can any one tell me how can I execute that by command ? Thanks & Regards (1 Reply)
Discussion started by: magasem
1 Replies

6. UNIX for Dummies Questions & Answers

How to change the MAC adress in ethernet adapter for SUN

I have installed in the server a quad ethernet adapter, I'm using two interfaces with two different IP networks, both interfaces are connected to a switch, the switch report that is receiving the same MAC address in both ports so must of the times I have connectivity problems. Any idea to change... (1 Reply)
Discussion started by: mono673
1 Replies

7. AIX

Capture IP Adress

hello I need for a script to capture the ip address from the connected user. I have 5 logical partitions. With "who", i have the ip adress, but only for 2 servers. Do you know another command to know the ip address of connected clients ? thank you (14 Replies)
Discussion started by: pascalbout
14 Replies

8. Solaris

IP-Adress

Hello together how can I find a ipadress from a login into remote system console? Thanks a lot Urs (1 Reply)
Discussion started by: MuellerUrs
1 Replies

9. UNIX for Dummies Questions & Answers

MAC-Adress

Hello I need to show my MAC-Adress on a Unix System, is there someone that know how? (2 Replies)
Discussion started by: nkochr
2 Replies
Login or Register to Ask a Question