Category Archives: tips & tricks

VMWare: Temporarily Mount Your Shared Folders To Your Guest OS

When working with your VMWare machine, you will be faced with file exchanges from your host OS to your guest OS. Now, VMWare folder sharing in Windows environment is way easy. Unix or Linux guest operating systems, however, will require you to mount your host shared folder(s) to your guest OS.

This article will guide you to mount your host OS shared folders to your Unix/Linux guest OS.

Steps:

  1. In your Unix/Linux guest OS, login as ‘root’ and create your mount directory:

vm1     In this example, I’m creating a directory called ‘shares’ in the root of my Linux filesystem.

2. In your VMWare menu options, go to the virtual machine Sharing menu and add your host OS folder:

vm2     In my example, I want to share the ‘Downloads’ folder of my Macbook to my Linux guest OS.

3. Go to your guest OS, in my example, in my Linux guest OS, open a Terminal session. Login as ‘root’ and mount the ‘Downloads’ folder to my Linux ‘shares’ folder:

vm3

Do note that this type of mount is just temporary. When I reboot my virtual machine, this mount will be gone.

IMPORTANT NOTE:  The default location for your mounted shared folder(s) will be in /mnt/hgfs. Regardless of reboot, you will still able to access your shared folder(s) in that location.

4. After you mounted your shared folder, verify that it is successful.

vm45. That’s it, you have successfully mounted your host OS shared folder(s) to your Unix/Linux guest OS.

So why would you need to do this if you can access your shared folder(s) in /mnt/hgfs?

There are scenarios when you want to control where you want to access your shared folders. Sometimes, the administrator restricts the permission of /mnt/hgfs if there are too many shared folders.

 

‘Til next time. Au revoir.

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:

:%s/Control-v-m//g

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

:%s/^M//g

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.

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: http://www.unix-ag.uni-kl.de/~massar/bin/cisco-decode
  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.

Reference:

The name Cisco referred by this article refers to Cisco Networks (www.cisco.com)