Mounting image remotely from the command line:

July 30th, 2011

If you are logging in remotely using ssh, the open command will pop up a screen when you try to mount an encrypted image, instead of presenting you the chance to enter a phrase on the command line. The proper command line equivalent is:

hdid foo.img

Using dtruss as an strace replacement securely

December 23rd, 2010

dtruss on Mac OS X uses dtrace, which requires superuser privileges. This is dangerous since doing
sudo dtruss app
allows the application you are debugging to have elevated privileges. If it is malicious or poorly written, it may just trash your system.

To run it securely, you need to do something like this:

sudo dtruss sudo -u username appname

where username is a user with regular privileges and appname is the application you want to trace. You can verify this yourself by playing with this simple program:

#include <iostream>
#include <unistd.h>
int main()
{
std::cout << "effective euid " << geteuid() << "\n";
}

With no privileges:

effective euid 501

using
sudo dtruss appname


effective euid 0

Using
sudo dtruss sudo -u username appname

effective euid 501

and you are subjected to trace information for one copy of sudo.

Transferring files between Linux and Mac with special characters

December 3rd, 2010

While both the Linux and Mac use UTF-8 encoding for their file names they use two different forms. Linux, being case sensitive, combines the diacritics with the letter (FORM-C). Mac OS X, being case insensitive, stores the diacritics separate from the letter (FORM-D). So if you rsync between Linux and Mac, you might see garbage characters.

To get around this, you need to compile your own version of rsync, since the one on Mac OS X is much older. The command to transfer is then something like:

rsync --iconv=UTF8-MAC,UTF-8 -avP user@remote:/files/ .

See this page for more information:
http://www.xelon.it/articles/rsync-mac-linux-windows/

Enabling 64 bit at boot

November 26th, 2010

This enables a 64 bit kernel, if you are currently booting with a 32 bit kernel. You can tell by looking under Apple->About This Mac->Software. If you see:

64-bit Kernel and Extensions: No

You can enable 64 bit as the default by entering the following in a Terminal and rebooting:

sudo systemsetup -setkernelbootarchitecture x86_64

Connecting to Linux Printer Servers from Mac OS X

November 26th, 2010

The first thing to do is enable printer sharing in Linux.  On the Linux machine, this can be done by using the GUI tool for your desktop environment, or connecting to http://localhost:631.

On the Mac OS X machine (Snow Leopard 10.6), add the following line to /etc/cups/cupsd.conf

BrowseProtocols all

and restart the mac services using:

sudo launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist
sudo launchctl load /System/Library/LaunchDaemons/org.cups.cupsd.plist

The next time you select printers from the pull down menu, you should see the available printers from your Linux print server.