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

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

How to Create a SSL Certificate on Apache for Ubuntu 12.04

How to Create a SSL Certificate on Apache for Ubuntu 12.04

About SSL Certificates A SSL certificate is a way to encrypt a…

How to Create a SSL Certificate on Apache for Ubuntu 12.04
How to Create a SSL Certificate on Apache for Ubuntu 12.04

About SSL Certificates

A SSL certificate is a way to encrypt a site’s information and create a more secure connection. Additionally, the certificate can show the server’s identification information to site visitors. Certificate Authorities can issue SSL certificates that verify the server’s details while a self-signed certificate has no 3rd party corroboration.

What the Red Means

The lines that the user needs to enter or customize will be in red in this tutorial!

The rest should mostly be copy-and-pastable.

Set Up

The steps in this tutorial require the user to have root privileges on the server.

Additionally, you need to have apache already installed and running on your server.
If this is not the case, you can download it with this command:

sudo apt-get install apache2

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
Linux

Mount The Drive on Linux Ubuntu Server

Determine Drive Information We assume that the hard drive is physically installed…

Determine Drive Information

We assume that the hard drive is physically installed and detected by the BIOS.

To determine the path that your system has assigned to the new hard drive, open a terminal and run:

sudo lshw -C disk

This should produce output similar to this sample:

*-disk
description: ATA Disk
product: IC25KOLAT564-0
vendor: Hitachi
physical id: 0
bus info: ide@0.0
logical name: /dev/sdb
version: C54671A
serial: XDfeSHKD556B
size: 37GB
capacity: 37GB

Deciding which partitions to mount

Most systems only have /dev/hda, which is the hard disk drive, and /dev/hdc, which is the CD-ROM, or optical, drive. If more were listed when the command above was run, they can be identified as follows: hda is the first drive on the first IDE channel (0:0), hdb is the second drive (0:1), hdc is the third drive (1:0), and hdd is the fourth (1:1). SCSI and S-ATA disks have names like sda and sdb.

Look through the list generated above to identify the partition(s) to be mounted. The following table lists some common ‘System’ types, which may help this process.

System name English name Linux type
W95 FAT32 Microsoft FAT32 vfat
W95 FAT32 (LBA) Microsoft FAT32 vfat
W95 FAT16 (LBA) Microsoft FAT16 vfat
W95 Ext’d (LBA) Microsoft extended partition Not used
NTFS volume set Microsoft NTFS ntfs
NTFS volume set Microsoft NTFS with read-write access ntfs-3g
Apple_HFS Apple HFS hfsplus

A list of the form ‘/dev/hda1: /media/windows/ (vfat)’, where ‘/dev/hda1’ is the device, ‘/media/windows’ is the arbitrary location where the partition will appear when mounted, and ‘vfat’ is the Linux type, should be created on paper, containing all partitions to be added.

Download Ubuntu Server

How to Setup a Dedicated Web Server for Free!

1. A Quick Overview In this tutorial, we are aiming to accomplish…

1. A Quick Overview

In this tutorial, we are aiming to accomplish several things:

  •  We’re going to install the Ubuntu Server operating system. I commonly use Ubuntu because of its ease of use and simple administration. It also has a rather large and extremely active community behind it, which makes getting support a breeze.
  • We’re going to install an OpenSSH server. This allows you to administer your server from remote computers.
  • A LAMP (Linux, Apache, MySQL, and PHP) stack is going to be installed. This provides the backbone that will run your web site. Apache is the industry standard web server on Unix-based operating systems; it’s what most web hosts use (NETTUTS is using it right now!) and it’s what we’re going to use.
  • We’re going to install a firewall to protect your server from unauthorized access.

In order to follow this tutorial, you’re going to need a few items:

  • A computer to use as your server. It doesn’t need to be powerful; as long as it’s not ancient, it’ll work fine. Please don’t do this on your desktop PC; Ubuntu will completely wipe your computer.
  • A CD burner and a blank CD. These are so that you can burn Ubuntu to a disk in order to install it.
  • Time. Seriously, this process is time-consuming, especially if you run into problems. Try to set aside an afternoon to follow this tutorial.

You may be asking why you’d want to have your own web server. There are several reasons, a few of them being: you can have your own testing ground for your websites; with a little modification, you could host your own site; and, you will learn a lot about Linux/Unix as you go.

With that said, let’s get started!