• Active Directory,  cloud,  Consulting,  iPhone,  Kerio,  Mac OS X,  Mac OS X Server,  Mac Security,  Mass Deployment,  Microsoft Exchange Server,  Network Infrastructure,  Windows Server

    Dig TTL While Preparing For A Migration

    Any time doing a migration of data from one IP to another where that data has a DNS record that points users towards the data, we need to keep the amount of time it takes to repoint the record to a minimum. To see the TTL of a given record, let’s run dig using +trace, +nocmd to turn off showing the version and query options, +noall to turn off display flags, +answer to still show the answer section of my reponse and most importantly for these purposes +ttlid to toggle showing the TTL on. Here, we’ll use these to lookup the TTL for the https://krypted.com/ A record: dig +trace +nocmd…

  • Mac OS X,  Mac OS X Server,  Mac Security,  Ubuntu,  Unix,  VMware

    Show Line Numbers When Viewing A File

    The nl command is used to show line numbers when viewing a file (unless you use the -b option along with an n, which seems to be one of the more pointless things to ever do at the command line, but then what do I know…). So if you’d like to see the line numbers for a file called xsbackup.sh: nl xsbackup.sh The output would look like this: 1 # 2 #!/bin/bash 3 # 4 # Script Name: Or at least, that’s how I used to do it. For decades I never noticed that cat had a -b option. So if you’d like to use cat to see line numbers…

  • Mac OS X,  Mac OS X Server,  Ubuntu,  Unix

    Get Ze Fuser!

    A quick and easy way to figure out what process ID and user has a file open is to use fuser. While fuser sounds like maybe some rad command that could emit lasers out of your laptop and fuse together your frenemies, it’s not. It also can’t put that bowl you just dropped off the table that you made when you were 6 and your mother still gushes over. I told you not to use it as an ash try she’ll say. Also, I don’t use it often as lsof can do such things as well. But sometimes you don’t wanna’ wait that long. So let’s look at using fuser.…

  • cloud,  Mac OS X

    One Liner To Install gcloud for Managing App Engine Instances

    I had previously been using the gcutil command. But I cheated a little with the one liner promise to get the new tool, gcloud, installed: curl https://dl.google.com/dl/cloudsdk/release/install_google_cloud_sdk.bash | bash ; unzip google-cloud-sdk.zip ; ./google-cloud-sdk/install.sh The installation shell script is interactive and will ask if you want to update your bash profile. Once run, kill your terminal app and the new invocation will allow you to log into App Engine using the gcloud command followed by auth and then login: gcloud auth login Provided you’re logged into Google using your default browser, you’ll then be prompted to Accept the federation. Click Accept. The gcloud command can then be used to check…

  • Mac OS X,  Mac OS X Server,  Mac Security,  Ubuntu

    Generating New SSH Keys

    Sometimes when we’re doing work, we end up changing an SSH key. You then access the host using something like this: ssh krypted@10.10.10.10 When accessing the host you then get a warning similar to the following if the key changed: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the ECDSA key sent by the remote host is aa:bb:cc:dd:ee:ff:00:11:22:33:00:11:22:33:44:55. Please contact your system administrator. Add correct host key in /home/remi/.ssh/known_hosts to get rid of this message. Offending ECDSA key in /home/remi/.ssh/known_hosts:1 In case you…

  • Mac OS X Server,  Ubuntu

    OS X Server: Forcing DNS Propagation

    Here I sat, tapping my fingers on the desk, waiting for a DNS change to propagate through a number of secondaries (note to self, I have too many secondary DNS servers at home). While sitting, tapping my fingers I dozed off and dreamt of fishing on the river I grew up on, of the sweet looks my daughter gives me and of retiring into a luddite colony of burning men and women in the desert. When I awoke and wiped the drool from my face, I realized I was wasting my life waiting for DNS to propagate. Then I flushed the cache one more time, just to see if it’s…

  • 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…

  • Ubuntu,  Unix

    Customizing vsftpd Banners

    vsftpd supports custom welcome banners. By default the vsftpd configuration files are stored in /etc/vsftpd. The main config file is /etc/vsftpd/vsftpd.conf. In this file there are two ways to display a banner. The banner_file parameter will allow you to build nice spiffy banners with multiple lines and paragraphs even (ASCII pr0n if you roll like that): banner_file=/etc/vsftpd/welcome.banner Or for simple setups (most are), the ftpd_banner parameter lets you configure a single line welcome string for unauthenticated users. Make sure this doesn’t wrap to the next line or the daemon won’t start. ftpd_banner=Welcome to krypted.com. The daemon will need to get restarted once changed. The easiest way to do this is to use /etc/init.d/vsftpd:…

  • cloud,  Mac OS X,  Mac OS X Server,  Ubuntu,  Unix

    Programmatically Interacting with Google Apps

    There are a number of ways that you can interact with Google Apps: there is the website, the new Google Cloud Connect and an API that allows you to integrate Google Apps with your own solutions. The API is available for python and java and can take some time to get used to, even though Google has done a good job with making it pretty straight forward (comparably). Therefore, there are a couple of tools that ease the learning curve a bit. GoogleCL on Ubuntu The first, and easiest is GoogleCL. GoogleCL is a command line version of Google Apps that will allow you to interact with YouTube, Picasa, Blogger…