how to, technology, tips & tricks, troubleshooting

Remove Control-M In Your Unix Script

Another tip to document:

I was once a victim of wanting to run my shell script only to realize one of the reasons why I can’t run it is because of the presence of Control-M character all over my script!

Why is it so?

The cause of such Control-M presence is due to the fact that the script was created using Windows based Notepad or any non-Unix editor. Now, the scripts have to be uploaded using FTP or SFTP to the target Unix server.

Currently there are largely available GUI based tool to perform the FTP or SFTP. But one thing isn’t clear is when you FTP in your scripts, you have ensure that the mode is in ASCII. If you missed it out, you will end up having Control-M characters in your scripts.

Back to the business of removing the Control-M character, just type this command using your ‘vi’ editor. Follow the key strokes:


After pressing the key strokes, you will see this in your ‘vi’ editor:


Now you can review your script and satisfied that the Control-M character is gone.

For safety, before even editing your shell script, you can back it up first using the cp (copy) command:

cp -p original_file backup_file

This command will copy the file to your target backup_file with the same permission as your original_file.

Til next time. Au revoir.

security, technology, tips & tricks, troubleshooting

Error 51: Cisco VPN Connectivity

Okay, so this is the first time that I’m going to write about sharing technology resolutions based on my experience working as a consultant.

Lots of enterprises today implement security standards especially when accessing their corporate resources from remote networks.

It is but a norm to use VPN connectivity in order to impose restrictions to qualified and approve personnels to allow to logged in beyond corporate firewalls.

Cisco VPN software is a common name when it comes to VPN access. If you are using Cisco VPN, it is likely that you have the VPN client tool that you normally launched in order to connect to your company network.

As I have downloaded the Cisco VPN client for Mac OS, I was trying to configure it to be able to connect to the customer VPN network. However, configuring the latest Cisco VPN client 4.9.x wasn’t that easy in the latest releases of Mac OS.

I was stucked with Error 51: when launching Cisco VPN client for Mac.

After searching the internet for all the relative resolutions, the below solution steps did resolve the problem I faced.

My Mac OS Environment: Mac OS X 10.6.7

Solution Steps:

  • Go to your Network Preferences

  • Click on the + button in order to add a new network connection. If you have locked your system settings, you have to unlock it first by providing an admin account of your Mac OS. The new network connection will require settings.
  • After clicking ‘Create’, you will need to provide the Server Address, etc…

  • Next, click on ‘Authentication Setting’…

  • Now this is where a little challenge begins. You have to provide the ‘Shared Secret’. If this is not provided by the Cisco Administrator, it is likely that there is a .pcf file that is provided to you which you normally import to the Cisco VPN Client tool in order to import all the config settings. In this case, since you are not using the client software, you need to do the following:
  1. Open your .pcf file in any text editor. Locate for the Encryption. Copy the value of the Encryption parameter.
  2. Go to this website:
  3. Provide the Encryption parameter from your .pcf file. Hit ‘Decode’ button and —
  4. You will see the Shared Secret in clear text.
  • Provide the Shared Secret in the network settings. The Group Name is also provided in your .pcf file.

  • Click ‘Ok’ and apply the settings. 
  • Now you can test logging in and provide your password (based on your login provided).

That’s it! You should be able to connect to the Cisco VPN of your company network.

In summary, you don’t actually need the Cisco VPN client for Mac in the latest Mac OS X versions as you can choose the Cisco IPSec protocol from the available Network Preferences.

As a code of ethics for us consultants, it is but included in the Non-Disclosure agreement that we are not allowed to share any customer information (names, passwords, etc) that we are working on. The above steps are helpful to work on the technology resolutions. I recommend not to abuse the VPN decoder link.

Til next time. Au revoir.


The name Cisco referred by this article refers to Cisco Networks (