Add Non Sudoer Account to the Sudoer User Group

Sunday, 29. July 2012

If you ever wanted to add a new non-sudoer account to sudoer group, here is the simple steps to help you achieve just that.

Log in to your server/machine as root.

Navigate and open the sudoers file

nano /etc/sudoers #Use your preferred editor
sudo visudo #Better as it checks for syntax errors.

Once the file is opened, navigate to the bottom of the file until you find the line like this below..

## Allow root to run any commands anywhere
root    ALL=(ALL)	ALL

Underneath this last line, add the account details you want make sudoer

useraccount ALL=(ALL)	NOPASSWD:ALL

This simply allows the new account to use/call the sudo commands without having to type the password.

Save the file, and restart your terminal session again.

Some time you may have to delete the following entry in order to make things working.. do this if the first steps still gives you the same error.

Scroll right at the bottom and look for this line:

#includedir /etc/sudoers.d

Remove it! Restart session and you should be OK!


Remove Everything After Character Pattern Preg_Replace Regex expression

Monday, 23. July 2012

A little snippet that simply removes everything after a matched pattern using preg_replace regular expression.


# remove everything after TEL: symbol
$address = "John Scott, Leeds, UK. TEL: 000111-234 345";
# new address
$new_address = preg_replace('/TEL:.*/i', '', $address, -1, $count);


Apply Zend Security Patch To Magento Installation Via SSH

Thursday, 19. July 2012

Here is a nice and quick way to apply the Zend Security Patch to your Magento install via SSH (command terminal)

Patch is only necessary for the versions less than CE Magento
This solution is for Magento CE to Change the patch file to match your version. More info here:

Command Line script

wget && patch -p0 -i CE_1.5.0.0-