Category Archives: Software

Cisco AnyConnect Secure Mobility: vpn.pkg is damaged and can’t be opened

I recently had to download and install the Cisco AnyConnect Secure Mobility client to connect to a VPN, however I was getting an error that seemed to indicate that the download was corrupted:

"vpn.pk" is damaged and can't be opened. You should eject the disk image.

Image 1

After a bit of trial an error, it turns out that the installation was being blocked by my OS X. What you need to do is temporarily change the “Allow apps downloaded from” option to “Anywhere.” You can do this under System Preferences > Security & Privacy:

Allow apps downloaded from: Anywhere

Image 2

After the installation, be sure to change the setting back.

System running out of memory: create a swap file

If you have a virtual private server (VPS) and are getting errors like “system running out of memory,” you may want to double check whether you’re using a swap volume or file.

Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. (source)

Continue reading

Prevent SSH connection from timing out in Terminal

If you’re constantly connected to multiple servers via SSH and perform work on them throughout the day, dealing with timeouts can be cumbersome. Here’s how you can keep the connection alive.

Create a config file in your home’s .ssh directory:

1
$ vi ~/.ssh/config
$ vi ~/.ssh/config

Add the following by pressing the letter i, typing in the text below, and pressing ESC followed by :wq:

1
ServerAliveInterval 60
ServerAliveInterval 60

Every 60 seconds a packet will be sent to keep the connection alive.

Lastly, modify the config file so that it’s read-only to you:

1
$ chmod 600 ~/.ssh/config
$ chmod 600 ~/.ssh/config

From here on out, no more timeouts.

Managing file and folder permissions when deploying with Git

Preface

I use Git as a version control and deployment system. When a website gets pushed to a server, all files get pulled into the web root (i.e. htdocs) by a user named git executing git pull in the post-receive hook.

By default, all files and folders git creates have 664 and 775 permissions, respectively, and are owned by that user. 664 translates to the user and group being able to read and write, and everyone else only being able to read, and 775 translates to the user and group being able to read, write and execute, and everyone else only being able to read and execute. (That’s a mouthful!)

1
2
-rw-rw-r-- 1 git  git   30 Aug  15  23:04 test-file.txt
drwxrwxr-x 1 git  git  102 Aug  15  23:04 test-directory
-rw-rw-r-- 1 git  git   30 Aug  15  23:04 test-file.txt
drwxrwxr-x 1 git  git  102 Aug  15  23:04 test-directory

Now, in an instance where you need a folder in htdocs writable by another user, like apache, for let’s say a caching system, you need to be able to set those particular permissions accordingly.

To accomplish this, you really only have two options:

  1. Set permissions of files to 666 and folders to 777
  2. Set the owner or group to apache (or a group that apache is a member of)

Personally, I favor restrictive permissions over convenience, so option #1 is out, which means we’re going to take a look at how to implement option #2.

Continue reading

Manually install stable version of APC in CentOS

First you’ll want to make sure you have all required packages installed:

yum install php-pear php-devel httpd-devel pcre-devel gcc make

Most tutorials will now say to use PECL to install APC:

[[email protected] ~]# pecl install apc
downloading APC-3.1.13.tgz ...
Starting to download APC-3.1.13.tgz (171,591 bytes)

But that actually installs the latest version, even if it’s in beta (in this case it is), so we’ll actually manually download and install it.

Continue reading