Cleaning up Magento 1.9 Disk Session Storage

When you choose to store Magento user sessions via file rather than DB, you may run into disk space consumption issues after a while. One resolution is to clean out older session files periodically.

The following commands have proven helpful.

Get the count of session files older than 5 days.

find /var/www/html/var/session/ -mtime +5 | wc -l

Delete session files older then 5 days.
find /var/www/html/var/session/ -mtime +5 -exec rm {} \;

Manual Install / Upgrade OpenSSH on Ubuntu

Recently I updated OpenSSH due to a PCI scan failure. We had OpenSSH 6.6 running on an Ubuntu 14.4.3 server. As of this writing OpenSSH is at 7.0 but has not been packaged for Ubuntu Aptitude yet.

UPDATE 08/23/2016: I just ran through this process again to install OpenSSH 7.3p on an Ubuntu 14.04 LTS box. Same commands worked without issue. One thing I did do different this time was uninstall the OpenSSH included with Ubuntu by running apt-get remove openssh-server. This guaranteed there was no conflict when installing from source.

This means I need to do a manual install of OpenSSH portable. It was pretty simple for me since I could use the default configuration. Your mileage may vary.


$ apt-get remove openssh-server
$ wget http://.../OpenSSH/portable/openssh-7.0p1.tar.gz
$ tar -zxvf openssh-7.3p1.tar.gz
$ cd openssh-7.3p1
$ ./configure
$ make
$ make install

To test this you can try connecting to local host to see the ssh version returned.
$ ssh -v localhost

Sources:

How to Manually Fork a GitHub Repo

Github doesn’t allow you to fork one of your own repositories to your account. In my case the reason this issue raised it’s ugly head is I’ve a private repo that I need to fork. I can’t just fork it to another user account because then I’d have to pay for a second account to support private repos.

So here’s my workaround.

  1. Create a new empty repo on Github.
  2. Clone the new empty repo down to my local dev machine.
  3. Add the original repo as the upstream of the new local repo.
  4. Now just fetch and merge the upstream master to new repo master.

In this way I can pull and push code between the two repos. The downside with this is Github doesn’t see the second repo as a fork. So there will be no managing pull requests in the Github UI.


$ git clone git@github.com:CreativeNotice/MyNewRepo.git
$ git remote add upstream git@github.com:CreativeNotice/Kraken-CF.git
$ git fetch upstream master
$ git merge upstream/master master
$ git push