Marius van Witzenburg We fight for our survival, we fight!

1Jul/110

How to fix ACL errors in diskutility

Posted by mariusvw

If you try to repair permissions and get a bunch of acls found but not expected.

To fix this some chmod commands need to be executed in the terminal.

Essentially open up a terminal and do the following:

cd /
ls -le

Look at the Applications and Library folders in the listing and you should see they have specific ACLs. On one of my machines the Applications folder had 2 and the Library had one. On the other both had just one.

To remove these ACLs do the following:

sudo chmod -a# 0 "/Applications"
sudo chmod -a# 0 "/Library"
# etc...

If you had more than one on either directory you can execute the same command until they are gone.

22Jun/111

How to make a VPN connection with Mac OS X on your iMac or Macbook (pro) to a FRITZ!Box

Posted by mariusvw

If you need some more info on how to configure your FRITZ!Box check out How to configure VPN on your FRITZ!Box 7340.

Configure your iMac or Macbook (Pro) to use VPN to your FRITZ!Box router VPN service.

First add a new VPN config by clicking the plus at the left bottom.

Next is to select Cisco IPsec and fill out a name at the Service Name field. This can be something like Home VPN.

Next is to fill out the VPN information in this configuration.

  • Server Address: add the IP or Host of your FRITZ!Box WAN connection.
  • Account Name: add YOUR_USERNAME.
  • Password: add YOUR_PASSWORD.

Click Authentication Settings and fill out the following.

  • Shared Secret: YOUR_SHARED_PASSWORD.
  • Group Name: add YOUR_MAIL_ADDRESS.

22Jun/110

How to make a VPN connection with iOS on your iPod or iPhone to a FRITZ!Box

Posted by mariusvw

If you need some more info on how to configure your FRITZ!Box check out How to configure VPN on your FRITZ!Box 7340.

Configure your iPod or iPhone to use VPN to your FRITZ!Box router VPN.

Goto the "Settings" of your iPod or iPhone and then goto "General".

Goto "Network".

Goto "VPN".

Goto "Add VPN Configuration...".

Fill out the screen below...

  • 1. add your own fancy description.
  • 2. add the IP or Host of your FRITZ!Box WAN connection.
  • 3. add YOUR_USERNAME.
  • 4. add YOUR_MAIL_ADDRESS.
  • 5. add YOUR_SHARED_PASSWORD.

To setup a FRITZ!Box router check out the following, it might help you getting started.

How to configure VPN on your FRITZ!Box 7340

22Jun/110

How to configure VPN on your FRITZ!Box 7340

Posted by mariusvw

FRITZ!Box

Setup the VPN settings on the FRITZ!Box with a VPN config file.

Save the content below to a file named vpn.cfg

vpncfg {
        connections {
                enabled = yes;
                conn_type = conntype_user;
                name = "YOUR_MAIL_ADDRESS";
                always_renew = no;
                reject_not_encrypted = no;
                dont_filter_netbios = yes;
                localip = 0.0.0.0;
                local_virtualip = 0.0.0.0;
                remoteip = 0.0.0.0;
                remote_virtualip = VPN_CLIENT_IP;
                remoteid {
                        key_id = "YOUR_MAIL_ADDRESS";
                }
                mode = phase1_mode_aggressive;
                phase1ss = "all/all/all";
                keytype = connkeytype_pre_shared;
                key = "YOUR_SHARED_PASSWORD";
                cert_do_server_auth = no;
                use_nat_t = yes;
                use_xauth = yes;
                use_cfgmode = no;
                xauth {
                        valid = yes;
                        username = "YOUR_USERNAME";
                        passwd = "YOUR_PASSWORD";
                }
                phase2localid {
                        ipnet {
                                ipaddr = 0.0.0.0;
                                mask = 0.0.0.0;
                        }
                }
                phase2remoteid {
                        ipaddr = VPN_CLIENT_IP;
                }
                phase2ss = "esp-all-all/ah-none/comp-all/no-pfs";
                accesslist = "permit ip any VPN_CLIENT_IP 255.255.255.255";
        }
        ike_forward_rules = "udp 0.0.0.0:500 0.0.0.0:500", "udp 0.0.0.0:4500 0.0.0.0:4500";
}

Replace the below values with the right settings for your network, I'll describe it with the default router values.

  • YOUR_MAIL_ADDRESS, replace this with your mail address.
  • VPN_CLIENT_IP, replace this with something like 192.168.178.201.
  • YOUR_SHARED_PASSWORD, replace this with your own preferred shared password.
  • YOUR_USERNAME, replace this with your VPN username, use [a-z] only.
  • YOUR_PASSWORD, replace this with your VPN password, mind quote signs!

This configuration has been tested on iOS and Mac OS X, check the manuals below to configure your client.

16Jun/112

How to fix the crackling (bad) sound of Bluetooth A2DP headsets or speakers on Mac OS X

Posted by mariusvw

If you found this post you probably ran into the same issue as I had, low volume on your headset or speakers or crackling sound.

The solution for this might sound more complex than it is, the Bitpool for the Bluetooth Audio Agent by default is 35, this seems to be too low if you also use a mouse and keyboard at the same time. In my case only a mouse. Raising it to a higher value solved this problem for me.

I raised it to 50 and it worked perfectly!

You can edit the preference file with a plist editor in this file: ~/Library/Preferences/com.apple.BluetoothAudioAgent

Or, more simple, you can run the following in the program Terminal located at /Applications/Utilities/Terminal.app

At the command line enter the following command:

defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" 50

After doing this you might need to reconnect your device or reboot your Mac to apply the change. In my case turning off the bluetooth adapter and enabling it again was enough.

I tested this with a Sennheiser PX 210 BT and it works perfectly!

14Jun/110

How to flush DNS cache in Mac OS X (Snow) Leopard

Posted by mariusvw

When you browse the web or access servers by name you slowly build up a cache of DNS queries.
This is information which site is hosted on what IP. In my work it happens that we move a domain to a new server, which requires me to be able to clear my cache to know faster if the DNS is working properly.

Running the following commands clears the cache and restarts the cache daemon so it will fetch changes that might have been done in the DNS records.
Flushing the DNS cache of Mac OS X differs from which version you are running of Mac OS X.
In both cases you need to start Terminal to run these commands.

For Leopard / Snow Leopard

sudo dscacheutil -flushcache

Note, you might need your password for the above command.

For Tiger

lookupd -flushcache

You alternatively might want to download the application MainMenu and give it a try... This gives you the ability to use menu's instead of commands in Terminal.

14Jun/115

How to add week numbers to iCal on Mac OS X

Posted by mariusvw

To make Mac OS X show week numbers in iCal is actually not that difficult.
You simply need to add the week number to the full date notation and your done.

Goto the System preferences

Path:  » System Preferences...

Goto Language & Text

Path:  » System Preferences... » Language & Text

Goto the tab Formats and then click Customize...

Path:  » System Preferences... » Language & Text » Formats

You will see a window where you can modify your notation format for date and time.
Now you have to put the week number of the year in the right place. Follow the red arrows :-)

Drag the week number to the full date field

Path:  » System Preferences... » Language & Text » Formats » Customize...

Finally close all windows and check the clock on the top right.

Now start your iCal and check the date bar at the top.

As you see, its really simple to get this done :-)

NOTE: Offset in the week number
Be sure you have the right country selected for your formats. Else you might end up with a week number with an offset. In my case the week number would be one week ahead. This cause my main country is The Netherlands and I have my system on United Kingdom. The thing you have to do is first select Dutch -> Nederlands and then change the week number. It might show weird having Dutch day names in iCal but hey... Apple made it work like this out of the box ;-)

Update 26-07-2011:
This works only for iCal versions below 5.0 which runs on 10.7 Lion, due the iPad layout the week numbers are not possible in this way!

As a temporarily solution subscribe to one of these (open page, click subscribe button):

  • For European: http://icalshare.com/calendars/195
  • For Norwegian: http://icalshare.com/calendars/190
12Jun/110

How to use a fully qualified domain name without an active DNS record for testing

Posted by mariusvw

Sometimes when you are moving sites between servers you might run into the problem that you must make contact with the new location by its real hostname. If you don't want the old DNS settings to be adjusted yet and want to test if everything runs fine first on your web server you can adjust the hosts file.

I'll explain this for usage on Mac OS X but of course it works the same on any other *nix environment.

Open Terminal form /Applications/Utilities/Terminal.app and enter the following command:

sudo vi /etc/hosts

Sudo will ask for your account password here.

After entering your password the program Vim will open the hosts file.

At the bottom add the following line by entering insert mode by pressing the i key:

160.79.58.10 test.domain.nl

This will point test.domain.nl to 160.79.58.10.

Now we are done editing we need to save the file first before this will work, this can be done by pressing Esc to exit insert mode and then enter :w to write the file.
You may also want to exit Vim by entering :q or the quick combination :wq.

Your hosts file should look something like this:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1	localhost
255.255.255.255	broadcasthost
::1             localhost 
fe80::1%lo0	localhost
 
160.79.58.10 test.domain.nl
14Sep/100

Having fun on April 1st with SSH and Mac OS X

Posted by mariusvw

Inspired by the latest MacAddict's April Fools' pranks, here are some very handy commands to remotely control a computer of which you are an administrator. These are most useful in a family environment where you own and administer the others' computers. They also work well over AirPort.

First, you need to ssh to the computer using your admin account. Then, you can type in any or all of the following commands.

[robg adds: Read the rest of the article for the pranks. Please note that some of these are quite nasty! Using your power as Admin to remotely reboot someone's machine, for example, is a simply horrendous thing to do. With that said, however, some of the following would be quite fun to do to someone with a good sense of humor...]

Note: Commands that are shown on two lines have the second line indented by two spaces. Enter the command on one line, removing all but one space between the end of the first displayed line and the start of the second...

Absolutely nasty:

sudo kill [program id learned from top] 
sudo halt
sudo reboot
sudo osascript -e 'tell app "[name of an open program]" to quit'

Note: using 'sudo open' over ssh does not give the user super-user privileges for the opened application.

Power:

sudo osascript -e 'tell app "Finder" to sleep'
sudo osascript -e 'tell app "Finder" to shut down'

General:

sudo open /Applications/iChat.app
sudo osascript -e "set volume 0"
sudo osascript -e "beep"
sudo osascript -e 'display dialog "Did you know that you are annoying?" buttons "Yes" with icon note'
sudo osascript -e 'tell app "Finder" to quit'
sudo open [path to an application]

Speech:

sudo osascript -e 'say "[whatever]" using "Zarvox"'
sudo osascript -e 'say "Dum dum dum dum dum dum dum he he he ho ho ho fa lah lah lah lah lah lah fa lah full hoo hoo hoo" using "Cellos"'
osascript -e 'say "oh This is a silly song silly song silly song this is the silliest song ive ever ever heard So why keep you listening listening listening while you are supposed to work to work to work to work its because i hate my job hate my job hate my job its because i hate my job more than anything else No its because youve no life youve no life youve no life and you better go get one after forwarding this crap" using "cellos"'

iTunes Control:

sudo open /Applications/iTunes.app; sudo osascript -e 'say "Play some music. Go on.  I dare you." using "Zarvox"'
sudo osascript -e 'tell app "iTunes" to stop' -e 'say "Please stop playing your annoying music" using "Zarvox"'
sudo osascript -e 'tell app "iTunes" to next track' -e 'say "I did not like that song very much" using "Zarvox"'
sudo osascript -e 'tell app "iTunes" to fast forward' -e 'say "This song is boring" using "Zarvox"'
sudo osascript -e 'tell app "iTunes" to quit'

Have fun, but not too much fun!

Source: http://hints.macworld.com

23Jul/105

iMac or Macbook (Pro), Self Assigned IP Address problem with Wifi Airport connections

Posted by mariusvw

I was having an issue with my Macbook Pro lately that the DHCP client couldn't get an IP from the DHCP server. This happened on different networks and it didn't happened every time. The message in the network settings was: "Self Assigned IP Address". After a while I really wanted to have a solution for this so I started spitting in the logs first...

I ended with no result at all, but suddenly I remembered that other programs might behave weird when their preference files are corrupted or if there are mistakes in them.

Then I found the following file:

/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist

I first turned off my airport before doing any action to this file.

I opened the file to sniff around and there it was, a missing close tag in the XML. I first fixed this, without no result as expected. Then I moved the file to my desktop, compressed it, trashed the original file and cleared my trash. Then I turned back on the Airport and clicked my network... It connected, since then my wireless problems are solved :-)

The error you see in the network preferences reads as follows: AirPort has the self-assigned IP address 169.254.67.44 and will not be able to connect to the internet.. But I'm sure you will notice that as soon you have this problem ;-)

Page 1 of 212