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

Linux

How to Add User To Group in Linux

You can use the useradd or usermod commands to add a user…

You can use the useradd or usermod commands to add a user to a group. The useradd command creates a new user or update default new user information. The usermod command modifies a user account i.e. it is useful to add user to existing group. There are two types of group. First is primary user group and other is secondary group. All user account related information is stored in /etc/passwd, /etc/shadow and /etc/group files to store user information.

useradd Example – Add A New User To Secondary Group

You need to the useradd command to add new users to existing group (or create a new group and then add user). If group does not exist, create it. The syntax is as follows:

useradd -G {group-name} username

In this example, create a new user called neo and add it to group called matrix. First login as a root user (make sure group matrix exists), enter:

grep matrix /etc/group

How to Set Up vsftpd on Ubuntu 12.04

How to Set Up vsftpd on Ubuntu 12.04

About vsftpd The first two letters of vsftpd stand for “very secure”…

How to Set Up vsftpd on Ubuntu 12.04
How to Set Up vsftpd on Ubuntu 12.04

About vsftpd

The first two letters of vsftpd stand for “very secure” and the program was built to have strongest protection against possible FTP vulnerabilities.

Step One – Install vsftpd

You can quickly install vsftpd on your server in the command line:

sudo apt-get install vsftpd
Once the file finishes downloading, the VSFTP will be on your server. Generally speaking, it is already configured with a reasonable amount of security. However, it does provide access on your Server to anonymous users.

Step Two – Configure vsftpd

Once vsftpd is installed, you can adjust the configuration.

Open up the configuration file:

sudo nano /etc/vsftpd.conf
The biggest change you need to make is to switch the Anonymous_enable from YES to NO:

anonymous_enable=NO

Linux

Apache Log Files on Server

Q. How do I find out Apache http server log files location?…

Q. How do I find out Apache http server log files location? How do I change the location of Apache log file under Linux / UNIX operating system?

A. There are two type of apache httpd server log files:

Apache Error Log File

All apache errors / diagnostic information other errors found during serving requests are logged to this file. Location of error log is set using ErrorLog directive. If there is any problem, you should first take a look at this file using cat, grep or any other UNIX / Linux text utilities. This apache log file often contain details of what went wrong and how to fix it. Default error log file location:

  • RHEL / Red Hat / CentOS / Fedora Linux Apache error file location – /var/log/httpd/error_log
  • Debian / Ubuntu Linux Apache error log file location – /var/log/apache2/error.log
  • FreeBSD Apache error log file location – /var/log/httpd-error.log