Showing hidden files in Mac OS X

This content is 18 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

I use hidden files (such as .htaccess) extensively on my website, so I needed to be sure that they were included with my local backup copy. Mac OS X doesn’t show hidden files by default (it all gets a bit messy otherwise – although they are visible in a Terminal shell); however I found a tip which details the commands to run in order to show hidden files in the Finder (this can be run using a standard user account):

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

To return to the default display, run:

defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder

I did find an application to display hidden files too but why bother if a couple of commands will do the trick? Even better, there is a workflow to show hidden files using Automator.

SSH addendum

This content is 18 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

Since my recent posts about using SSH to securely remote administer Mac OS X, Linux and Windows computers, a couple of extra points have come up that are probably worth noting:

  • To use the console interactively, it may be better to use PuTTY (putty) than PuTTY Link (plink). In seems that PuTTY Link is fine for setting up a tunnel and then connecting using VNC, RDP or another remote control method but I found that control codes were echoed to the console window when I connected to a Linux of Windows computer and the command line experience was generally better using PuTTY interactively. This is because (quoting from the PuTTY documentation) “The output sent by the server will be written straight to your command prompt window, which will most likely not interpret terminal control codes in the way the server expects it to […] Interactive connections like this are not the main point of Plink”.
  • For another method of generating SSH keys, an online SSH key generator is available (I haven’t tried it myself).

Secure, remote administration of a Windows computer

This content is 18 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

I was going to call this post “secure, remote administration of a Windows computer from within Windows” but that sounds a bit odd, unless you realise that the last two posts have been “secure, remote administration of a Linux computer from within Windows” and “secure, remote administration of a Mac OS X computer from within Windows“. Basically, after getting SSH tunneling to work for administering Mac OS X and Linux machines, I thought that it would make sense to apply the same principles to Windows.

John Fitzgibbon’s comparison of free SSH and SCP programs for Windows 9x, NT, ME, 2000 and XP explains the various SSH server options for Windows but one option he doesn’t mention is Tevfik Karagülle’s CopSSH, which I found on a list of free SSH implementations recommended by OpenSSH.

CopSSH bundles parts of OpenSSL, OpenSSH and Cygwin into a Windows installer. It’s straightforward to install, and includes a GUI interface to activate a user for SSH, including the generation of a public/private key pair (saved to %programfiles%\copSSH\username\username.key and %programfiles%\copSSH\username\username.key.pub). The private key needs to be imported into PuTTYgen after which it can be saved in PuTTY’s .PPK format and used as previously described for Mac OS X and Linux. The only other point to note is that the sshd_config file is stored in %programfiles%\copSSH\etc and requires the same AllowTcpForwarding yes and PasswordAuthentication no settings as seen previously.

To access the desktop via VNC, I installed UltraVNC Server on the target machine noting there are two settings that need to be configured for a successful connection through the SSH tunnel:

  • A password must be defined for VNC connections.
  • Loopback connections must be allowed.

That’s fine for using an SSH tunnel to secure a VNC session, but why not tunnel remote desktop (RDP) connections to Windows servers instead of using VNC? In theory, all that should involve is changing the forwarded source port from 5900 (VNC) to 3389 (RDP) and setting the corresponding SSH port forwarding destination to localhost:3389 but Windows doesn’t like that, producing an error message as follows:

Remote Desktop Disconnected

The client could not connect. You are already connected to the console of this computer. A new console session cannot be established.

One suggested fix is to change the destination to use another address from the loopback range (e.g. 127.0.0.2) but I found this just directed me to my own machine (as might be expected with a loopback). For a while, it looked as though the resolution would be related to a change made in Windows XP service pack 2, which prevents connections to loopback addresses other than 127.0.0.1, and Microsoft knowledge base article 884020 includes a hotfix that alters this behaviour but I don’t think it helped me much (I later removed the hotfix and didn’t notice any differences). Eventually I got things working by creating a new forwarded source port of 3390 and destination of localhost:3389 for SSH port forwarding, after which I could connect using mstsc /v:loopback:3390.

It’s been an interesting few days getting acquainted with using SSH tunnels to securely connect to remote systems running a variety of operating systems – hopefully posting my experiences here will be useful to others.

Secure, remote administration of a Linux computer from within Windows

This content is 18 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

Yesterday I wrote about using SSH to securely connect to a Mac from a Windows PC. At the time, I suggested that the advice should be equally applicable to a Linux system, or even to a Windows Server with an SSH server installed and I’ve since tested it with a Linux machine (running Fedora Core 5).

The Linux process is almost identical to my original post for Mac OS X, except that:

  • The sshd_config file is found in /etc/ssh.
  • SSH is enabled in the firewall using the system-config-securitylevel command.
  • The SSH deamon is restarted using the service sshd restart command.
  • GNOME includes a VNC server called vino, which needs to be enabled (users of other graphical environments will need to choose an alternative VNC server).

(Also… RTFM… I spent a lot of time trying to work out why I couldn’t connect, only to find that I’d neglected to place the public key in ~/.ssh/authorized_keys).

Falko Timme has written an excellent tutorial on key-based SSH logins with PuTTY which outlines all the key steps (in fact, if I knew that existed then I wouldn’t have spent so much time writing up the process here!) but Jeremy Mates’ OpenSSH public key authentication article includes a useful troubleshooting guide for public key authentication problems.

VNC is all very well for forwarding the entire desktop, but X11 forwarding can be used to run individual X applications on the Windows machine. Because Microsoft Windows doesn’t include an X Window server, it is necessary to download an X11 port for Windows – I used XMing. Once XMing (and the XMing fonts) were installed and running, I edited my PuTTY connection to enable X11 forwarding and ensured that the sshd_config file on the Linux box included X11Forwarding yes (that was the default on my Fedora Core 5 installation) and could launch an xapplication from within the PuTTY terminal window with xapplicationname & (e.g. xeyes &) (I found this information at the Linux Documentation Project). XEyes is nothing special, so how about running a Linux application on the Windows desktop… try mozilla & or gimp & – it feels “wrong” but it’s also pretty impressive and oh so “right” at the same time!

Using XMing to run X11 applications on a Windows XP machine

Secure, remote administration of a Mac OS X computer from within Windows

This content is 18 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

In a recent post about multimedia file format conversions, ripping DVDs, playback and more, I linked to a number of Mark Pilgrim’s “How To” articles; however there was one which wasn’t relevant to that particular post – how to use your Mac from anywhere (although it is intended for remote control of a Mac the advice should be equally applicable to a Linux system, or even to a Windows Server with an SSH server installed).

A few months back, I blogged about using creating an SSL VPN to access my network but Mark’s video explains how to open a single firewall port and use SSH to provide a secure tunnel through which other protocols (in this case VNC) can be run for remote administration of a single computer. I tried it earlier and it’s very straightforward. Best of all, the software involved is all freely available under open source licensing agreements!

I recommend downloading Mark Pilgrim’s video for a full explanation but the notes below explain what is involved (some of the Unix concepts may be unfamiliar to those more used to a graphical environment and my quick introduction to Linux for Windows administrators might be useful):

  1. Download and install the PuTTY, PuTTYgen, Pageant and Plink SSH utilities on a Windows PC.
  2. Using puttygen, generate a public/private key pair and protect it with a passphrase. Save the private key to a file on the Windows PC and copy the public key to the remote computer (e.g. within a text file transmitted via e-mail or FTP).
  3. On the Mac, open a terminal session (either using the OS X Terminal application or an alternative such as iTerm) and enter the following commands from the home (~) directory:
    • mkdir .ssh (this was already present on my machine as I already had the SSH server running).
    • chmod 700 .ssh (again, I didn’t need to do this).
    • chmod 600 publickeyfilename (the default permission set is 640).
    • mv publickeyfilename .ssh/authorized_keys
    • sudo nano /etc/sshd_config (non-admin users may need to su - to an admin account first as explained in my earlier post about running sudo as a standard user) and make the following edits:
      • Allow SSHtunnelling (also known as TCP forwarding or port forwarding) by changing #AllowTcpForwarding yes to AllowTcpForwarding yes
      • (Optionally) Prevent the use of usernames and passwords for login (the public/private key pair and passphrase will provide the security for the connection) by changing #PasswordAuthentication yes to PasswordAuthentication no
      • (OS X 10.4 only) Disable pluggable authentication modules by changing #UsePAM no to UsePAM no
    • Exit nano and save the changes to /etc/sshd_config (exit to the original shell if su was previously used to escalate privileges).
    • Generate an SSH key fingerprint (to prevent man-in-the-middle attacks) using ssh-keygen -l -f /etc/ssh_host_rsa_key.pub and make a note of the fingerprint.
  4. Open TCP port 22 on any firewalls/routers between the Windows and Macintosh computers and enable port forwarding to the appropriate internal IP address (it may be necessary to apply a static IP address to the Mac but I prefer to use a DHCP reservation).
  5. If the external IP address for the network is not static (mine is) then use a dynamic DNS service to assign a DNS name so that it may be located on the Internet.
  6. Within the OS X System Preferences, Open Sharing and enable Remote Login (restart the service if it is already running in order to pick up the changes made earlier to /etc/sshd_config). Because password authentication has been disabled, remote login (SSH) will only be possible from a machine with the appropriate private key.
  7. Although OS X includes Apple Remote Desktop, which is a VNC server, alternatives such as Vine Server (OSXvnc) offer additional functionality. In particular, VNC is insecure by default; however by selecting to only allow local connections (require SSH) and start the system server (i.e. run as a service, rather than in the context of a particular user), it is possible to run a secure VNC server each time the system is restarted.
  8. At this stage, it should be possible to create an SSH tunnel to the Mac. On the Windows PC, run pageant which is a PuTTY helper application (SSH agent) to cache the passphrase for the private key, which adds a level of security if the PC is compromised but which would also become a nuisance if it needed to be repetitively entered. Add a key using the private key file generated in step 2 and enter the passphrase that was used when created the key.
  9. Next, run putty and enter:
    • The hostname/ipaddress in the basic session options.
    • The auto-login username for the Macintosh for the connection data.
    • The privatekeyfilename for SSH authentication.
    • A new forwarded source port of 5900 and destination of localhost:5900 for SSH port forwarding.
  10. Save the session with an appropriate sessionname and open the connection. On the first connection, the host key will be unknown; however the reported key can be compared with the one generated earlier to ensure that the host is the intended target computer. Assuming that all is well and the connection is allowed to continue, then a Welcome to Darwin! greeting should be displayed, along with a shell prompt.
    • If the connection fails and there is a prompt for the private key then Pageant is not correctly configured.
    • If there is a prompt for a password then /etc/sshd_config was not correctly edited.
  11. Unless command line interaction with the Mac is required, the PuTTY window can be minimised. In order to create the SSH tunnel automatically at login, a startup shortcut can be created with the target of "%programfiles%\PuTTY\pageant.exe" privatekeyfilename -c "%programfiles%\PuTTY\plink.exe" sessionname
  12. Finally, a graphical connection may be initiated with a VNC viewer such as UltraVNC. The connection should be made to localhost; however because localhost:5900 has been defined as the forwarded port in the SSH tunnel, the request is securely transferred to the VNC server on the Mac.

It’s worth noting that when I originally tried to test this configuration from a remote network I was unable to get past my employer’s firewall; however there are plenty of unsecured wireless networks around which I could use to test the connection!

Note that the original information that provided inspiration for writing this post is licensed under a creative commons attribution sharealike 2.5 license and consequently so is the information contained in this post.

Multimedia file format conversions, ripping DVDs, playback and more

This content is 18 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

Recently, I’ve had cause to convert various multimedia items between formats and it’s not always been straightforward. I’m still learning as DRM, codecs and platform-related issues often complicate the process but this post summarises what I learned along the way with:

  • Grabbing audio content from another application.
  • Trimming audio files down to a particular section.
  • Converting Flash video (.FLV) files to video (as well as converting between a variety of other video formats).
  • Ripping DVD content for playback on the computer.
  • Playing Windows Media content on a Mac.
  • Playing QuickTime content in full-screen mode without buying QuickTime Pro.

I carry out most of my multimedia work on a Mac but some of these solutions will be equally applicable to Windows and possibly even to Linux users.

Grabbing audio content from another application

I’ve just three words to say that will describe how I did this – Audio Hijack Pro – a great application from Rogue Amoeba which takes the audio from any running application and allows it to be recorded.

Trimming audio files down to a particular section

In this scenario, I had about half an hour’s worth of audio, but only wanted to publish a section which was about 3 minutes in length. Apple QuickTime Pro will let me trim tracks, but didn’t seem to let me set the start and end points as accurately as I needed. There is another Rogue Amoeba application that I could use for this (Fission) but tasks like this are pretty rare for me and I didn’t want to pay $32 for what could potentially be a single use (the demo version inserts fades into the track to encourage purchase of the full software which seems fair enough as at least it lets me try before I buy). Instead, I used MP3 Trimmer from Deep Niner – the interface may not be as good as Fission’s, but it’s a fully-functional demo with no time limits and registration is just $10.95 should I find myself needing to trim MP3s more often.

Converting Flash video (.FLV) files to video (as well as converting between a variety of other video formats)

I spent all afternoon yesterday trying to work this one out – I had a bunch of Flash videos which I had downloaded from a website and although I could play them using Eltima Software’s SWF and FLV Player, I wanted to play them in iTunes. After searching the net for hours all roads seemed to lead to a Windows application that would convert the files to MPEG4 format for me (Moyea FLV to Video Converter). The demo version of this application inserts a watermark in the centre of the video (again, that’s fair enough – this is try before you buy) but as I really wanted something for my Mac I decided not to part with the $39.95.

Later that evening, my friend Alex recommended Perian to help me out with problems ripping a DVD (see below) and I found out that the Perian component for QuickTime had already been installed (probably when I had a quick look at the Democracy Player a few weeks back) so QuickTime could already play back my .FLV files! Because I have QuickTime Pro, it can also save the files as .MOVs although I’ve since found Vixy – an online service that will also carry out the conversion from Flash video to a variety of MPEG4 video formats including .AVI/.MOV/.MP4 and .3GP or to .MP3 (audio only).

After I’d done all this, Alex (who really should blog more often about the huge volumes of Mac and Internet-related stuff that he knows and I don’t) told me that he uses iSquint for converting Flash Video for iTunes playback. I had been under the impression that iSquint would reduce the picture size for iPod playback but it seems it can also retain TV size (whatever that is). iSquint also has a grown-up brother – Visual Hub – and, although I haven’t used it yet, it looks to be a pretty useful program which “bridges the gap between numerous complicated video formatting standards”.

Another toolset which may be useful is ffmpegX, which provides a Mac OS X interface to a number of open-source video and audio processing tools. There’s also the Apple QuickTime MPEG-2 Playback component, which enables QuickTime to play Video CD (MPEG1) and DVD (MPEG2) content and even convert them to MPEG4.

Ripping DVD content for playback on the computer

Ripping DVDs. Surely that’s illegal? Only if I then pass copies on to others, which of course I won’t, will I? Let’s be clear from the start that I’m only talking about backing up legally purchased content for personal use.

One application commonly used to make backup copies of DVDs is Mac the Ripper. There is a Windows application called DVDShrink (which allows the DVD content to be reauthored and if necessary “shrunk” to fit on a standard DVD) but to simply rip a copy for local playback the most commonly used application is HandBrake (also available for a while as MediaFork but the two development streams have now merged and future versions will be known as HandBrake). I was having problems using this last night but once I stopped trying to rip at a constant quality of 100% quality (and stuck with the default setting of an average bitrate of 1000kbps – perfectly acceptable for computer playback) everything was fine.

Others have written better guides on this than me… you can find some here:

Playing Windows Media content on a Mac

Although I have a copy of Windows Media Player 9 for Mac OS X (which I think came with Office 2004 for Mac), Microsoft discontinued development of this product a while back and now distributes the free Flip4Mac Player as the Windows Media Components for QuickTime. Unfortunately there is no support for content that is protected with Windows Media digital rights management (DRM) but I’m sure there are cracks and workarounds for those who are motivated to do so… if the BBC distributes content in Windows Media format (therefore cutting out Mac and Linux users) then I might even have a look myself… the Wikipedia article on DRM is a good place to start.

Playing QuickTime content in full-screen mode without buying QuickTime Pro

Apple QuickTime Pro it is a handy application for $29.99 (although, yet again Apple rips us off in the UK with a dodgy exchange rate so it’s £20 here) as it can be extended to play other media formats (as discussed above); however one of the Pro benefits is playing content in full-screen mode. It seems that Mac users can trick the standard QuickTime application into playing content in full-screen mode using a little AppleScript. For QuickTime users on Windows, I wrote about some methods for full-screen MPEG4 playback last year – including simply playing the content through iTunes!

I hope this pile of multimedia tips has been useful. Comments are welcome from those who have other free or low-cost solutions to contribute to the mix.

Mac OS X keyboard shortcuts

This content is 18 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

After my backup hard disk failed a couple of weeks ago, I needed to be sure that a hard reset of my Mac hadn’t damaged anything so I fired the machine up in single user mode and ran AppleJack.

As it happened, there was nothing wrong, but there’s no harm in a bit of preventative maintenance from time to time; however I had forgotten the keypress to bring Mac OS X up in single user mode – for future reference, Apple has a document which details OS X keyboard shortcuts.

Portable applications – an alternative approach to mobile computing

This content is 18 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

I’ve been playing around with the idea of running operating systems from USB flash drives for a while now but the main problem is USB boot support in the hardware I use (most notably the Fujitsu Siemens Lifebook S7010D that I use for work doesn’t support it).

A while back I wrote about my experiences of booting Windows PE from a USB flash drive (and I believe that new versions of PE make this easier) but the reality is that I haven’t needed this – it not really anything more than a challenge that I set myself to see if it could be done and for those (up to now, theoretical) “system down” occasions there are CD-based solutions that I can use (e.g. Knoppix STD, Trinity Rescue Kit or Winternals Administrators Pak).

For other occasions (like working on someone else’s PC), there is the option of a portable application. I tried out two such packages tonight (my favourite Windows FTP program – FileZilla – and Mozilla Firefox) and was very impressed. Neither of these applications is installed on my wife’s Windows XP PC and yet I was able to run the portable versions of the them both from my USB flash drive without leaving any files behind. It’s the ultimate in mobile computing – literally anytime, anyplace, anywhere – as long as you can borrow a (Windows) PC!

There are alternative solutions such as U3 and MojoPac but, as far as I can tell, these rely on kernel hacks to implement technology such as roaming desktops and the beauty of the Portable Applications solution is that, even though there is an application “suite” available, I can just run the individual applications that I need, on any Windows PC, without any specialist hardware – and it’s free.

Relaxing naps with pzizz

This content is 18 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

If you ask my wife what’s my biggest problem and she’ll probably tell you that I don’t know how to relax. Well, actually I do, but I don’t do it very often and when I finally do stop, I usually find that my body thanks me by catching a cold or something similarly unpleasant.

The trouble is that there is so much to do… digital photos to edit and print for the family album… half a dozen unfinished blog posts… a dozen never-even-started blog posts… website(s) to update/redevelop… office to tidy up find under a mountain of paperwork… analogue music collection to rip… learn to play the guitar (again)… catch up my reading… get my motorbike running again… sell a pile of stuff on eBay (iPAQ, SDLT drive, motorbike)… get rid of the old computers in the garage… you get the picture – and that’s not considering the important stuff like making time for my wife and children, going out to work for a living and catching up with friends.

There’s another side to this – my health. I’m 5 stone overweight (4 stone above what I consider to be realistic) and 35 years of age in April – if I don’t do something soon then I really will start to get ill. I need to make time in my busy schedule to get fit – and I need to relax.

pzizzI was talking over some problems with a good friend a few nights back and he suggested meditation. Now I don’t know anything about meditation, but I am becoming quite interested in the whole idea of keeping my mind, body and spirit in balance (I guess it’s another one of those triangulation things – like I find that you can cope with issues in any one of home, work and love-life but if two of the three start to have problems then it gets really bad) – I even went to a Hatha Yoga class on Friday night (the woman on my wife’s Yoga DVDs still makes me cringe though).

pzizzSo what’s this got to do with a technology blog? Well, quite a lot actually, because my friend’s meditation suggestion got me thinking. It’s not meditation, but I did hear Merlin Mann (writer and consultant on personal productivity, “life hacks”, and simple ways to make your life a little better) talking about pzizz on a podcast (probably MacBreak Weekly, or This Week in Tech).

pzizzOriginally available as hardware but now as software for Windows or the Mac, pzizz is a dynamic relaxation system – kind of like a relaxation CD for energising naps or simply getting to sleep; but actually far more than that as you can customise each track and select how long each nap will last. I wasn’t entirely convinced at first, so I downloaded the sample 15 minute naps and was very impressed (particularly when taking an energizer nap at my desk as I started to flag in the middle of the afternoon). Thinking that might have been a fluke (hey, shutting your eyes and chilling out for 15 minutes is bound to be relaxing isn’t it?), I tried it again today – and felt great. So good in fact that I then went out for a brisk walk (another one of my life hacks – albeit one recommended by my doctor) and it’s true – exercise does make you feel good (various gym memberships over the years have just made the each gym’s bank balance look good – to the detriment of my own)!

pzizzRight, so that’s energising naps and regular exercise sorted… now all I need to do is cut down on the Diet Coke with Cherry intake…

Free backup software for Mac OS X

This content is 18 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

A couple of years ago I suffered a hard disk failure and I was very lucky to retrieve most of my data from other sources. That should have taught me to keep backups but I’m still not as good as I should be. My work laptop is hardly ever backed up (but most important items are also available in my e-mail) and I should really do a better job with my server at home (although most of the data is software that could be downloaded again). What really worries me is having to re-rip my iTunes library (and re-purchase tracks bought from the iTunes store) or, even worse, losing my digital photos (some of which are irreplaceable images of my family) and so I really must make backups of the data on my Mac.

One of the failings of Mac OS X is a lack of built-in backup software. Actually, that’s not true – there are standard Unix utilities such as rsync and Apple does provide advice for how to back up and restore your files but if you want to use Apple Backup, then you need a .Mac subscription (I believe that software like this should really be included with the operating system).

Thinking that there must be plenty of people who have experienced this issue previously, I went googling for free backup software for the Mac and found a list of backup programs courtesy of Pure Mac. First of all, I tried SmartBackup, which looks great, but it also costs $19.50, and whilst I’d be happy to part with cash for something if it really hits the mark, as I mentioned previously, I could script something from the command line for free. Another option was RsyncX, but this will not run on Intel Macs, so I got looking at automated backups using rsync. Although rsync is incredibly powerful , it was looking as though it would take me some time to work out exactly what I would need to back up (although Pete Freitag’s article on how to backup your Mac incrementally over ssh looked useful), until I stumbled across rsyncbackup – a set of scripts with documentation, designed to simplify setting up an rsync-based backup routine.

In the end, I settled on the easy option – using a program called iBackup, which is free for personal and non-commercial use and seems to do everything that I need it to. It’s pretty basic but all I really need is to make regular copies of my data to a second external hard disk. iBackup supports scheduled backups using multiple backup profiles and features a system of plugins to back up application settings. Above all, it’s easy to use (although it doesn’t run as a service so needs to be running for anything to happen, although it can be minimised).

Of course, I still need to back my photos up to DVD from time to time and store the media off-site (in case I have a fire or something else that wipes out the Mac and both my hard drives) but at least I now have some protection against losing those essential family photos.