FirePHP Firefox extension causing CodeIgniter session lost

Recently I ran into problems in all CodeIgniter projects using session library.

Symptom: session_id is being reset randomly and all session data are lost.

After an hour of tracing I finally found the “bug”:

  • FirePHP modified the User Agent string when FireBug enabled
  • CodeIgniter destroy the current session due to invalid User Agent
  • New session started, old session data lost

To fix the problem just disable $config['sess_match_useragent'] in config.php,
or disable “Modify User-Agent Header” in FirePHP option (recommended).

P.S. I used to think it’s related to an old CodeIgniter AJAX bug and $config['sess_time_to_update'], but finally found they are totally irrelevant.

Enable root access on Amazon EC2 Instance

According to Amazon Linux AMI User Guide, root access is disabled by default for security reason.

How do I get root SSH access on my Amazon Linux AMI instance?
The Amazon Linux AMI does not allow remote root SSH by default. You should specify a key pair at instance launch and login as ec2-user using your key pair to access the command line. This user has sudo access by default to allow you to run root actions. If you want to enable remote root login, please be aware that it is significantly less secure than relying on key pairs and a secondary user.

You are strongly recommended to use sudo to run root actions:

sudo yum upgrade

or getting root shell by running:

sudo -i

I understand the risk, what if I REALLY want it?

You can enable root access for SSH/SFTP if you want,
it’s especially useful when you want to overwrite some config files via SFTP.

Continue reading “Enable root access on Amazon EC2 Instance”