• Mac OS X,  Mac Security,  Mass Deployment

    Sticky DHCP Leases in Mac OS X

    I did an article some time ago about how DHCP leases work. From that, I’ve gotten a number of questions about why, after you click on Renew DHCP Lease in the Network System Preference pane, you sometimes see the information until you get a new lease. You can also reset the lease from the command line, which does not usually show you a new lease in the GUI immediately. To reset the DHCP lease from the command line, use ipconfig: ipconfig set en0 BOOTP ipconfig set en0 DHCP If the information is displayed on the screen, then it has to be stored somewhere, right? When your system sends an acceptance…

  • Mac OS X,  Mass Deployment,  Ubuntu,  Unix

    Using dirname and basename For Paths In Scripts

    There are two commands that can be really helpful when scripting operations that involve filenames and paths. The first of these is dirname: dirname can be used to return the directory portion of a path. The second is basename: basename can be used to output the file name portion of a path. For our first example, let’s say that we have an output of /var/db/shadow/hash/850F62CD-966C-43A7-9C66-9F9E6799A955, which we know contains the encrypted password for a given user. To just see the UUID here would be done using the following extremely basic incantation of basename: basename /var/db/shadow/hash/850F62CD-966C-43A7-9C66-9F9E6799A955 Basename can also be used to trim output. For example, let’s say we didn’t need…

  • Active Directory,  Mass Deployment

    Merging csv Data in Microsoft Excel

    Many data migrations are handled in Excel. When migrating data you often find yourself “massaging” the data a bit. To do so, I often use Excel. For example, let’s look at taking a first and last name and then creating a short name that has a firstname.lastname convention and a full name that has a firstname (space) lastname convention. This can be done with formulas pretty quickly. First, let’s place our firstname into column A and our lastname data into column B, making sure that the first and last names for the rows match up (usually validating the first row and last row will be good enough). To start a…

  • Mac OS X Server,  Mac Security

    Apache2 & umasks

    I’ve been noticing more and more people using Apache as a way of getting files to and from servers. Call me silly but I think we’re going to continue to see more and more of this. A really common issue that comes up with Apache2 is default permissions of new files. Mac OS X is great with ACLs and whatnot. But Apache is built for posix. Posix is built on the foundation that the permissions of new files that are created come from umask. If you have a script that uploads a file then you can set the permissions as part of the script. But if you just pull it…

  • Mac OS X,  Mac OS X Server

    Moving Time Machine Backups

    Many of you may have noticed that you can’t use cp or ditto to move Time Machine backups. But you can use asr. This is because moving a Time Machine backup needs to be block level in most cases. Let’s look at doing so in Disk Utility. Disable Time Machine Moving Time Machine backups to a new disk is a bit tricky for some, due to the restrictions placed around the files that Time Machine uses. To do so, first disable Time Machine. To do so, open the Time Machine sytem preference pane turn off Time Machine. Partition the New Volume Next, connect the current backup volume and your new…