By default in Linux, an SSH can freely navigate around your file system. I recently needed to restrict an SSH user to their home directory. You need rbash.
CentOS doesn’t ship with rbash enabled as default. It was easy enough to solve.
ln -s /bin/bash /bin/rbash
Then change /etc/passwd so that the user’s shell is /bin/rbash.
sudo cp /usr/share/zoneinfo/Europe/London /etc/localtime
A super quick, one line install of wkhtmltopdf
wget https://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.10.0_rc2-static-amd64.tar.bz2 && tar xvjf wkhtmltopdf-0.10.0_rc2-static-amd64.tar.bz2 && mv wkhtmltopdf-amd64 /usr/bin/wkhtmltopdf
Quite often you’ll need pdftk also
wget http://pkgs.repoforge.org/pdftk/pdftk-1.44-2.el6.rf.x86_64.rpm && rpm -Uvh pdftk-1.44-2.el6.rf.x86_64.rpm && pdftk
Here’s how I installed Linux HyperV Services on CentOS which allows vital integration between Linux hosts and Hyper-V Service Center Virtual Machine Manager such as Time Keeping, Drive Support, Fastpath Boot, Heartbeat, SMP, Live Migration and loads of other great things.
mount -o loop LinuxICv34.iso /mnt/
** Updated August 2014
I recently had to upscale a client’s CakePHP application across multiple front-end web servers on AWS. CakePHP’s file system cache and session storage doesn’t cut it any more. I needed a way of sharing sessions and cached objects. Step in Redis. A centralised, in-memory database, much like memcache – but nicer!
Continue reading “CakePHP and Redis”
Batik for HighCharts allows you to create static PNGs from dynamic data. HightCharts offers a hosted export server, sometimes I don’t want to use a 3rd party service.
Here’s how I installed the Apache Batik SVG Toolkit to create PNGs from HightCharts on CentOS
You’ll need a HighCharts download also.
yum install batik
yum install batik-rasterizer
chmod 777 highcharts/exporting-server/php/php-batik/temp
cp batik-rasterizer.jar lib/ ../highcharts/exporting-server/php/php-batik/ -r
yum install bitmap*
yum install dejavu*
ln -s /usr/share/fonts/dejavu /usr/share/fonts/dejavu-lgc
Need to access a Microsoft SQL Server on Linux? You’ll be wanting FreeTDS for that.
It is easy to install on CentOS. You’ll also need to install the Remi Repo.
yum install freetds
yum install freetds-devel
yum install –enablerepo=remi php-mssql
Here’s an Ubuntu version.
I’ve bumped into this message a few times on different servers. The message offers no insight into why you can’t connect to a remote server over SSH.
It usually means the the ~/.ssh/authorized_keys file is corrupt, for example there is an incorrect or single corrupt line in this file. I’d recommend stepping through line by line and finding the offending line.
I needed a way to remove selected keys from Redis. FLUSHALL is bad! The DEL command only takes one argument which is time consuming.
Here’s how you can delete multiple matching keys in one line. Continue reading “Quickly delete Redis keys by pattern”
Installing nano is done using the yum system.
yum -y install nano
System Default Editor
During login, a number of scripts are run to setup the environment. In CentOS, a file for each subject is used. These are stored in a system profile directory, /etc/profile.d/. There are two environment variables that control which editor to use.
cat <<EOF >>/etc/profile.d/nano.sh