touch helloperl.pl Open helloperl.pl and paste the following in there: print "Hello Cruel Perln"; Make sure you have executable permissions for helloperl.pl. Then run: perl helloperl.pl
-
- Mac OS X, Mac OS X Server, Mac Security, Mass Deployment, Network Infrastructure, Unix, Windows Server
"Don't Go Near There": Sponsored Top Level Domain Names
Any time I think of something you’re not supposed to do with network architecture, I always think of Good Morning Vietnam. When Robin Williams says: “Don’t go near there!” But Betty! “Don’t go near there…get away from the river! Stay away from there!” One of the things you’re not supposed to do on networks is have conflicting DNS information. One example is to use a www record on one DNS server and a different one on another DNS server. This introduces a potential problem when some users end up with one DNS server and others end up with another. IP, DNS and other conflicts are usually a bad thing. Another…
-
Scripting in Google ChromeOS
I recently got my hands on one of those Google ChromeBooks (Cr-48). Interesting to have an operating system that is just a web browser. But, as anyone likely reading this article already knows, the graphical interface is the web browser and the operating system is still Linux. But what version? Well, let’s go on a journey together. First, you need ChromeOS. If you’ve got a ChromeBook this is a pretty easy thing to get. If not, check http://getchrome.eu/download.php for a USB or optical download that can be run live (or even in a virtual machine). Or, if you know that you’re going to be using a virtual machine, consider a pre-built…
-
Web Site Redirection with html (Lion too)
One of the first things many Apache administrators end up with in their bag of tricks is a piece of code for redirecting a website to another place. 301 redirects are usually better, but a basic redirection page is also very helpful in a number of situations. The following example code can be saved as an index.html page and will redirect traffic from one site to another. A common use of this is to redirect an http site to an https site. In this example, we’ll place this index page in the web directory for https://krypted.com/ on an OS X Lion server. The server runs a site for https://krypted.com/ already…
-
Aliasing Commands
I find there are a lot of commands I run routinely. Some of which are pretty long strings that are thrown together in order to find what can, at times, be a small piece of information. Or, I might routinely log into a server and want to trim down the command required to do so. Let’s take an example of this in using the open command to vnc into a server. The command to open a server in this fashion would be (assuming a server name of mail.mygroup.mycompany.com, a username of krypted and a password of mypass): open vnc://krypted:mypass@mail.mygroup.mycompany.com For this exercise we’re going to be saving the above command…
-
NTP, OS X, Windows, Cisco and You
At this point, most Mac admins know to how to enable ntp on a Mac OS X Server and set clients to the server. Most Mac admins also know how to use managed preferences to set ntp as well. We all know that time is pretty important and most are using ntp at this point. Network time should, almost by definition, be continuous, which allows ntpd in Mac OS X can update clocks in small denominations. Thus, managing corrections with little overhead or impact to the system enables ntp to be an inexpensive method for managing clocks. But ntp is also built to keep things running smoothly even when there…
-
Making Autocomplete a Bit Less Sensitive
I can’t stand it when I open terminal and go to cd into a directory I know to exist only to be confused by why using the tab doesn’t autocomplete my command. For those that don’t know, when you are using any modern command line interface, when you’re indicating a location in a file system, the tab key will autocomplete what you are typing. So let’s say you’re going to /System. I usually just type cd /Sys and then use the tab to autocomplete. In many cases, the first three letters, followed by a tab will get you there and you can therefore traverse deep into a filesystem in a…
-
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…
-
Converting pst Files to mbox
Large scale mail migrations can be tricky. There is a shareware app that can be used to migrate pst files from the pst format into mbox, which can then be used with Mac OS X http://www.littlemachines.com. If the migration process needs to be automated (they all seem to at scale) then a script could be written to crawl users, finds the pst files and then convert them. Or it could be done on the client side using a self-destructing launchd item. Conversion syntax for libpst would be something like the following: readpst -o /output/folder /server/path/user.pst Before you can use readpst, it needs to be built via libpst on the system that…
-
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:…