Uncategorized

A Better sudo for Dreamhost PS

June 11th, 2010 0 Comments

Tired of having to su to your sudo users on your dreamhost server?  Here’s a quick script to help.

Requirements:

  • You have a sudouser setup on your dreamhost account.  These are only available for private servers.
  • Make sure ~/bin is in your path.

Now to the good stuff.

Puth the following code into ~/bin/sudo

    #!/bin/sh
    su yoursudouser -c "/usr/bin/sudo $*"

    Make the file executable

      $ chmod +x ~/bin/sudo

      You can now do the following from your normal user:

      $ sudo ls

      Timing the Command Line

      August 4th, 2009 0 Comments

      What to find out how long command will take to run? Perhaps you need to know how long your capistrano deployment is taking to run.

      Just type ‘time’ in front of your command and you’re done:

      $ time ps aux
      ...
      root        14   0.0  0.1    77000   1896   ??  Ss   23Jul09  43:36.24 /usr/sbin/configd
      root        13   0.0  0.0   601332    632   ??  Ss   23Jul09   4:02.60 /usr/sbin/syslogd
      root        12   0.0  0.0   600236    440   ??  Ss   23Jul09   5:40.11 /usr/sbin/notifyd
      root        11   0.0  0.1    78872   3460   ??  Ss   23Jul09   8:05.65 /usr/sbin/DirectoryService
      root        10   0.0  0.0    75968    992   ??  Ss   23Jul09   0:01.82 /usr/libexec/kextd
      root         1   0.0  0.0   600820    536   ??  Ss   23Jul09   3:22.52 /sbin/launchd
      ...
      ps aux  0.01s user 0.04s system 6% cpu 0.694 total

      That’s all there is to it.

      From the man pages:

      NAME
      time -- time command execution
      
      SYNOPSIS
      time [-lp] utility
      
      DESCRIPTION
       The time utility executes and times utility.  After the utility finishes,
       time writes the total time elapsed, the time consumed by system overhead,
       and the time used to execute utility to the standard error stream.
       Times are reported in seconds.

      Software I’m Using – February 2009 Edition

      February 25th, 2009 0 Comments

      I thought I’d post a list of software I’ve been using consistently for the last month.  I’ve broken it down to stuff I use on a day-to-day basis and on a several-times-a-week basis.  Kind of nice that I didn’t have to put Visual Studio on either list.

      Every Day

      Several Times a Week

      Metasploit Framework

      September 11th, 2008 0 Comments

      I stumbledupon the Metasploit project last night.

      “Metasploit provides useful information to people who perform penetration testing, IDS signature development, and exploit research. This project was created to provide information on exploit techniques and to create a useful resource for exploit developers and security professionals.”

      Basically, it’s an exploit framework that makes it very easy to run exploits against local and remote systems with a chosen payload, such as a remote shell or reverse VNC session. It comes with a library of exploits for all sorts of OSes and software, even SCADA.

      Another interesting note is that the Metasploit framework is written in ruby and has several user interfaces including a command line, gtk gui, and a Rails web interface.

      http://www.metasploit.com/

      Fear the Metasploit Framework

      Bash: cd to Last Directory

      June 4th, 2008 3 Comments

      I’ve been using bash forever and never knew about this:

      $ cd -

      This will let you change directory to your previous location in the file system. It’s and easy way switch back and forth between two directories.

      Auto Export Firefox 3 Bookmarks

      June 4th, 2008 0 Comments

      As of Firefox 3, bookmarks are saved in a places.sqlite database file instead of the usual bookmarks.html file. This breaks functionality with some extensions and, more importantly, application launchers like Launchy and Find and Run Robot. To fix this, you can configure Firefox 3 to auto-export your bookmarks to your bookmarks.html file. To do this, enter about:config in your browser location bar and change the browser.bookmarks.autoExportHTML key to true. Now when you exit Firefox, your bookmarks will be written to your bookmarks.html file for your extensions and app launchers to use.

      She Said YES!

      December 11th, 2007 0 Comments

      This weekend, on 12/8/07, I asked the most beautiful girl in the world to marry me and she said YES. YES!!

      Here are the pictures.