Linux

Delete All base on filename extension in folder and subfolders

Using Terminal and Find command. find . -iname ‘*.jpg’ -type f -exec…

Using Terminal and Find command.

find . -iname '*.jpg' -type f -exec rm -f {} \;

This command starts in the current directory, recursing through the entire subtree, looking for files only that end with ‘.jpg’. It will delete any such files.

find – the find program
. – search the subtree starting in the current directory
-iname ‘*.jpg’ – find all elements that match the shell pattern ‘*.jpg’. This should be done case-INsensitively
-type f – only match files
-exec rm -f {} \; – execute the command “rm -f {}” for each matched file, where ‘{}’ is replaced with the name of the matched file.

Also adding an -delete it should do the same.

find /yourdirectory -iname '*.jpg' -delete

Linux Malware Detect

Installing Linux Malware Detect on CentOS 6

I’m going to show you in few step how to install the…

I’m going to show you in few step how to install the LMD on your linux server.

What is Malware? well, Malware is short for malicious software, such as a virus, which is specifically designed to disrupt or damage your computer system.

What is LMD? Linux Malware Detect (LMD) is an open-source malware scanner that runs under various flavours of Linux, distributed under the GPL2 license.

Downloading LMD:

You can either use your user home directory or tmp folder for installation files.

cd ~

wget http://www.rfxn.com/downloads/maldetect-current.tar.gz

Installing LMD

tar xfz maldetect-current.tar.gz

cd maldetect-*

./install.sh

The first command unpacks the archive.  The second changes the folder to the unpacked archive and the third command runs the install script. You may come across a “permission denied” message when running the install script. If this happens do the following

Postfix Mail

How to send mails in POSTFIX through external SMTP

This short guide shows how you can set up Postfix to relay…

Postfix Mail
Postfix Mail

This short guide shows how you can set up Postfix to relay emails through another mailserver. This can be useful if you run a Postfix mailserver in your local network and have a dynamic IP address because most dynamic IP addresses are blacklisted today. By relaying your emails through another mailserver that is hosted on a static IP address in a data center (e.g. your ISP’s mailserver) you can prevent your emails from being categorized as spam.

First step, you will need to make changes in your configuration file (in standard postfix configuration it would be /etc/postfix/main.cf). You need to add at the end of configuration file following lines:

I’m going to use Nano editor to edit my configuration file.

nano /etc/postfix/main.cf

Configuration

Server

Backup & Restoring Tips for Large Files in Plesk 11.0.9

When it comes to Plesk Backup Manger there are few things that…

When it comes to Plesk Backup Manger there are few things that you might need to configure in order to backup large files successfully.

For backing up, Plesk stores backups in “/usr/local/psa/PMM/tmp” and in most dedicated servers, you have limited amount of space in this directory so we are going to create a symbolic link from “/var/lib/psa/tmp” to “/usr/local/psa/PMM/tmp”.

1. Stop psa by using the following command.

/etc/init.d/psa stop

2. Make tmp directory

mkdir /var/lib/psa/tmp

3. Set permissions
chown psaadm:psaadm /var/lib/psa/tmp
chmod 755 /var/lib/psa/tmp

4. Remove tmp from PMM directory

rm -R /usr/local/psa/PMM/tmp

PHP Logo

Install PHP Mcrypt extension on CentOS 6 in 3 Supper Easy Steps

The php-mcrypt extension is not available on CentOS 6 or RHEL 6 (with/without…

The php-mcrypt extension is not available on CentOS 6 or RHEL 6 (with/without Parallels Plesk 11) although some applications such as Magento or phpMyAdmin require it to work properly.
We can easily install it though from the Fedora Project repositories or any other repository that include php-mcrypt.

1. Download the following RPM pacakges by using wget command:

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/php-mcrypt-5.3.3-1.el6.x86_64.rpm
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/libmcrypt-2.5.8-9.el6.x86_64.rpm

2. Install them using YUM:

yum localinstall php-mcrypt-5.3.3-1.el6.x86_64.rpm libmcrypt-2.5.8-9.el6.x86_64.rpm

3. Reload Apache server to load the extension up:

service httpd restart

Linux

Zip Example: How to Do!

The zip command under UNIX is use for a compression. It works…

The zip command under UNIX is use for a compression. It works as a file packaging utility for the following operating systems:

1. Unix
2. VMS
3. MSDOS
4. OS/2
5. Windows 9x/NT/XP, 6. Minix
7. Atari
8. Macintosh
9. Amiga
10. Acorn RISC OS.

Simple Examples

The syntax is as follows:

zip file.zip file1.txt file2.doc photo.jpg ...

To zip resume.doc and all *.c file, enter:

zip bacup.zip resume.doc *.c

To zip data directory, enter:

zip -r backup.zip data

UFW - Uncomplicated Firewall

UFW – Uncomplicated Firewall

The default firewall configuration tool for Ubuntu is ufw. Developed to ease…

The default firewall configuration tool for Ubuntu is ufw. Developed to ease iptables firewall configuration, ufw provides a user friendly way to create an IPv4 or IPv6 host-based firewall. By default UFW is disabled.

Gufw is a GUI that is available as a frontend.

Basic Syntax and Examples

Default rules are fine for the average home user

When you turn UFW on, it uses a default set of rules (profile) that should be fine for the average home user. That’s at least the goal of the Ubuntu developers. In short, all ‘incoming’ is being denied, with some exceptions to make things easier for home users.

Enable and Disable

Enable UFW

To turn UFW on with the default set of rules:

sudo ufw enable

To check the status of UFW:

sudo ufw status verbose

The output should be like this:

How To: PPTP VPN on Ubuntu 12.04 (pptpd)

PPTP VPN on Ubuntu 12.04 (pptpd)

Install Software sudo apt-get install pptpd ufw Allow Ports 22 and 1723…

Install Software
sudo apt-get install pptpd ufw

Allow Ports 22 and 1723 on UFW and Enable UFW
Warning: if you are connected to SSH on a port other than 22, please adjust the first command accordingly so you don’t get kicked off.

sudo ufw allow 22
sudo ufw allow 1723
sudo ufw enable

Edit /etc/ppp/pptpd-options
use your favourite editor in this case I use “sudo nano /etc/ppp/pptpd-options” and make sure you have the following parameters for encryption.

refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128

Server

How to Use the vi Editor

This help note explains the basics of vi: opening and closing a…

This help note explains the basics of vi:

  • opening and closing a file
  • moving around in a file
  • elementary editing

vi has many other commands and options not described here. The following resources can help you get started using the vi editor, and are available at the UW University Book Store:

  • “vi Tutorial.” Specialized Systems Consultants (SSC).
  • “vi Reference.” Specialized Systems Consultants (SSC).
  • “Learning the vi Editor.” Linda Lamb, 1990.

Starting vi

You may use vi to open an already existing file by typing

      vi filename

where “filename” is the name of the existing file. If the file is not in your current directory, you must use the full pathname.

Or you may create a new file by typing

      vi newname

where “newname” is the name you wish to give the new file.

Server

FIX: Plesk and Sendmail Problem PHP

From the command line, enter this below. /usr/local/psa/bin/domain -u yourdomain.com -mail_service false…

From the command line, enter this below.

/usr/local/psa/bin/domain -u yourdomain.com -mail_service false

You do not need to restart the server. This tells Plesk to not use the mail server to send mail for that domain. It will then go through the correct MX entry for the domain and send it to an external domain. Specially for those who use Google Apps on Plesk.

You will need to do this for every domain hosted on the server.