Add check memory method
Add check permission method
Fix check permission method

$EUID can not work in Ubuntu 14.04, use another method to replace it.
Merge branch 'pichuang-master'