Category: Linux

  • tcpdump ASCII

    tcpdump out ASCII characters and not see headers

    -s Snap Length – Grab the entire 1500 byte packet
    -A ASCII
    -l stdout line
    -i interface

    tcpdump -s 1500 -A -l -i eth0
  • Start a screen session as another user at system startup

    Came across this technique to get a screen session started as another non-root user on system startup. You could have this command in /etc/rc.local or any other location that runs on system startup as root.

    Also, it doesn’t have to just be at system startup. These commands could be used at any time by the root user to start a screen session for another user.

    This command must run as root. I had best luck when providing full paths to the executable and optional file arguments (like if you are passing a conf file)

    su – username -c "/usr/bin/screen -dmS screenname ./executable"

    So, for example, to get irssi started as chris in a screen session named irc, You could:

    su – chris -c "/usr/bin/screen -dmS irc /usr/bin/irssi"

    You can then log in to the box as chris and resume the screen session that root started.

  • Netatalk with Debian or Ubuntu

    By default, it is compiled without SSL support. Mac clients will not be able to connect. Here is how you get Netatalk working on Debian or Ubuntu the clean way, with custom compiled packages.
    [bash]
    apt-get source netatalk
    apt-get install devscripts fakeroot libssl-dev cracklib2-dev
    apt-get build-dep netatalk
    cd netatalk-2.0.3
    DEB_BUILD_OPTIONS=ssl debuild
    dpkg -i ../netatalk*.deb
    [/bash]

    If you get an error message about keysigning (when building), this command may help:

    [bash]
    DEB_BUILD_OPTIONS=ssl dpkg-buildpackage -us -uc
    [/bash]

    http://www.blackmac.de/archives/58-Make-Netatalk-talk-to-Leopard-Mac-OS-X-10.5.html

  • Netatalk on Intrepid once again

    This sequence of commands work well for me to get a SSL-enabled version of Netatalk compiled “the Debian way” or “the Ubuntu way”, where you get a nice .deb file:

    [code]
    mkdir -p ~/src/netatalk
    cd ~/src/netatalk
    sudo apt-get install devscripts cracklib2-dev dpkg-dev libssl-dev build-essential
    sudo apt-get build-dep netatalk
    apt-get source netatalk
    cd netatalk-2.0.3
    DEB_BUILD_OPTIONS=ssl dpkg-buildpackage -us -uc
    sudo debi
    [/code]
    Now you can install the .deb package that was just created.

    You will want to set Netatalk “on hold” so that it will not update, killing your custom SSL version:

    [code]
    echo "netatalk hold" | sudo dpkg –set-selections
    [/code]

  • Recursive grep search with filenames and line numbers

    Slack and Bill at worked helped me out with a nice recursive grep search. It is now my favorite:

    egrep -irHn <searchterm> <path>

  • Mounting a lvm crypted device via the command line

    #cryptsetup luksOpen /dev/HARDDISK DEVICENAME
    #lvmdiskscan
    #vgchange -ay
    #ls -l /dev/mapper
    #mkdir /media/crypt
    #mount /dev/mapper/DEVICENAME /media/crypt

  • AFP File Sharing from Linux to Mac

    I posted something on this a while back, and someone in the comments posted a great howto. I felt it is worthy of another link so it is easy to find. This basically lets your Linux box share files using the AFP protocol which is very fast and the native file sharing protocol for Mac OS X.

    http://www.kremalicious.com/2008/06/ubuntu-as-mac-file-server-and-time-machine-volume/

    This person built a DEB package for modified netatalk which works on Ubuntu Ibex:

    L’Airone al servizio del Leopardo [Update 3]

  • PHP phpinfo() on the fly

    Here is a little trick to get phpinfo() information on the fly.

    You need php-cli installed (sometimes its called php4-cli or php5-cli)

    echo "&lt;?php phpinfo(); ?&gt;" | php4
    echo "&lt;?php phpinfo(); ?&gt;" | php5
    echo "&lt;?php phpinfo(); ?&gt;" | php5-cli

    etc

    You can also tack on a | grep at the end if you want to filter for certain words.

  • Turning Ubuntu Hardy into OS X

    Since I’m an Apple fanboy now of course I love the OS X experience. I wanted to theme my Ubuntu to look nicer and came across this link. I love the new fonts the most! They kick the trash out of the built in fonts.

    http://maketecheasier.com/turn-your-ubuntu-hardy-to-mac-osx-leopard/2008/07/23

  • SUID Search

    find / \( -perm -004000 -o -perm -002000 \) -type f -print