Go Back   The macosxhints Forums > OS X Help Requests > Networking



Reply
 
Thread Tools Rate Thread Display Modes
Old 10-09-2006, 06:54 AM   #1
hisara
Major Leaguer
 
Join Date: Mar 2006
Posts: 280
Spoof MAC-address/Root User?

I'm trying to change MAC-address, but it fails. I think it requires Root User? SpoofMAC application uses Root user, even i didnt enable it in NetInfo Manager. Why this cant change it:

do shell script "sudo ifconfig en1 ether <MAC address>"

I dont want to enable Root User in NetInfo Manager just because this.

Last edited by hisara; 10-09-2006 at 08:13 AM.
hisara is offline   Reply With Quote
Old 10-09-2006, 01:42 PM   #2
trevor
Moderator
 
Join Date: Jun 2003
Location: Boulder, CO USA
Posts: 19,854
You should not need to enable the root user. Sudo gives you temporary root privileges.

1. Can you tell us why you want to change your MAC address? Perhaps there is a better way to do what you are trying to do. What is your higher level goal?

2. You are using en1, the second interface on your computer. Is that the interface you are trying to change? On many Macs, en1 is the Airport interface, although on my PowerMac G5 dual-core, it is the second wired ethernet interface. Are you really trying to change en1 or do you actually want to use en0 there?

3. What form are you entering the MAC address in? It should be "a series of colon-separated hex digits."

4. Why don't you, for troubleshooting purposes, go directly to the command line, bypassing Applescript? Just open up your Terminal, and enter the
sudo ifconfig en1 ether MA:CA:dd:re:ss:00


What response do you get? What do you then get from
ifconfig en1 | grep ether

5. Exactly how do you know it fails? Are you checking with another ifconfig command? Or checking from an external device? Which one? What is your methodology?

6. Is the interface up when you try to change it's MAC Address? It needs to be up.
sudo ifconfig en1 up

Trevor

Last edited by trevor; 10-09-2006 at 01:46 PM.
trevor is offline   Reply With Quote
Old 10-10-2006, 05:01 AM   #3
hisara
Major Leaguer
 
Join Date: Mar 2006
Posts: 280
I'm trying to change MAC-address for Airport, which is en1.

It complained that "not in the sudoers file. This incident will be reported." so i enabled "Allow user to administer this computer" first. I dont want to keep that preference turned on all the time, so is there a way to change MAC-address using Standard-account?

If i use Terminal:

Home:~ myname$ sudo ifconfig en1 up
Password:
Home:~ myname$ sudo ifconfig en1 ether 11:22:33:44:55:66
Home:~ myname$ ifconfig en1 | grep ether
ether ol:dm:ac:ad:dr:es
Home:~ myname$

If i try AppleScript:

do shell script "sudo ifconfig en1 up"
do shell script "sudo ifconfig en1 ether 11:22:33:44:55:66"
do shell script "ifconfig en1 | grep ether"

Event Log:

tell current application
do shell script "sudo ifconfig en1 up"
""
do shell script "sudo ifconfig en1 ether 11:22:33:44:55:66"
""
do shell script "ifconfig en1 | grep ether"
" ether ol:dm:ac:ad:dr:es "
end tell


>Exactly how do you know it fails? Are you checking with another ifconfig command?
>Or checking from an external device? Which one? What is your methodology?

Home:~ myname$ ifconfig en1 | grep ether
ether ol:dm:ac:ad:dr:es

BTW, how long sudo gives temporary root priviledges? Is there easy way to make it shorter?

Thanks
hisara is offline   Reply With Quote
Old 10-10-2006, 07:08 AM   #4
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
You forgot to answer Trevor's first question (#1) - which was the most important one.

To change anything related to the system as a whole will require administrator access.

The timeout for 'sudo' access is 5 minutes. This is configured in the file /etc/sudoers
But you can use 'sudo -k' to "kill" the timeout immediately.
Read 'man sudo'
__________________
hayne.net/macosx.html
hayne is online now   Reply With Quote
Old 10-10-2006, 12:37 PM   #5
trevor
Moderator
 
Join Date: Jun 2003
Location: Boulder, CO USA
Posts: 19,854
As Hayne mentioned, please answer my question #1. It is very likely that we can help you better with this information from you.

Quote:
It complained that "not in the sudoers file. This incident will be reported." so i enabled "Allow user to administer this computer" first.

This is exactly why it is best to troubleshoot these commands directly from the command line, instead of using Applescript. You did not see this error message in Applescript, so you could have continued doing this until you were blue in the face and got nowhere. From the command line, you saw an error message and were able to correct the problem by enabling your user as an Admin.

By default, sudo gives temporary root privileges to Admin users. To change the MAC address, which is a very important change to your entire computer, you must have root privileges, which by default you can only get from an Admin account. If you read man sudo, you will see that sudo can actually be highly customized using the /etc/sudoers file, and these defaults can be changed. But be very very aware of any security implications of any changes you make to this file--you don't want to lock and bar the front door to your computer but leave the back door wide open with a flashing neon sign saying "Expensive Stuff Here" on it.

Quote:
Home:~ myname$ sudo ifconfig en1 up
Password:
Home:~ myname$ sudo ifconfig en1 ether 11:22:33:44:55:66
Home:~ myname$ ifconfig en1 | grep ether
ether ol:dm:ac:ad:dr:es

Hmmm. Odd. I don't have an Airport installed in the computer I'm typing at now, but this works fine for me on the wired ethernet interfaces that I can directly test. I'll post again after I've tested this with an Airport card.

Trevor
trevor is offline   Reply With Quote
Old 10-10-2006, 03:49 PM   #6
bramley
MVP
 
Join Date: Apr 2004
Location: Cumbria, UK
Posts: 2,461
The utility at '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources' called 'airport' has an option that allows the MAC address of the card to be changed - which might be tried if the ifconfig approach doesn't work.
bramley is offline   Reply With Quote
Old 10-18-2006, 12:09 AM   #7
Fabruccio
Registered User
 
Join Date: Oct 2006
Posts: 1
Thumbs down The airport utility does nothing

Sorry to inform you that the following command:
Code:
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport --mac=AU:TR:EA:DR:ES:SE
does nothing on OS X 10.4.8
Fabruccio is offline   Reply With Quote
Old 10-18-2006, 05:09 AM   #8
bramley
MVP
 
Join Date: Apr 2004
Location: Cumbria, UK
Posts: 2,461
Quote:
Originally Posted by Fabruccio
Sorry to inform you that the following command:
Code:
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport --mac=AU:TR:EA:DR:ES:SE
does nothing on OS X 10.4.8

If the MAC address shown is the one you are trying to change to then I'm not surprised - the MAC address used needs to be in valid EUI-48 format.

Last edited by bramley; 10-18-2006 at 08:17 AM.
bramley is offline   Reply With Quote
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 On
HTML code is Off

Forum Jump



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


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.