ithut (.) net

Howtos and Tutorials from behind the firewall

  • Home
  • Android
    • Root Your Phone
    • Android News
  • Urdu Tutorials
  • Top Tutorials
  • Forum
  • Policies
    • Copyright Policy
    • Comment Policy
  • Contact us
Twitter Youtube RSS
Category Archives: Linux

What’s the recommended way to enable / disable services in Ubuntu?

Posted on May 17, 2013 by Muhamamd Zeeshan
No comments

GUI WAY

UBUNTU (Classic Gnome / Fallback) GUI WAY

  1. Go to System -> Preferences -> Startup Applications
  2. Here you can click and enable/disable SOME of the services that start from a Desktop Ubuntu. Simply click on one to Enable/Disable. Note that not all services appear here, commonly only the ones that involve a system tray icon or GUI windows. Examples like the HP System Tray and the Nvidia Settings.

UBUNTU 2D/3D

  1. Open the Dash and type startup app, you should see one option:

enter image description here

  1. Open the Startup Applications App and Enable/Disable any of the services you find there. As in the Classic Gnome/Fallback way, it will only show services related to the GUI. For example: Read more …
Categories: Linux, Ubuntu | Tags: debian, Linux, linux mate, linux mint, mint, ubuntu

Linux: 25 PHP Security Best Practices For Sys Admins

Posted on January 24, 2013 by Muhamamd Zeeshan
No comments

PHP is an open-source server-side scripting language and it is a widely used. The Apache web server provides access to files and content via the HTTP OR HTTPS protocol. A misconfigured server-side scripting language can create all sorts of problems. So, PHP should be used with caution. Here are twenty-five php security best practices for sysadmins for configuring PHP securely.

Our Sample Setup For PHP Security Tips

  • DocumentRoot: /var/www/html
  • Default Web server: Apache ( you can use Lighttpd or Nginx instead of Apache)
  • Default PHP configuration file: /etc/php.ini
  • Default PHP extensions config directory: /etc/php.d/
  • Our sample php security config file: /etc/php.d/security.ini (you need to create this file using a text editor)
  • Operating systems: RHEL / CentOS / Fedora Linux (the instructions should work with any other Linux distributions such as Debian / Ubuntu or other Unix like operating systems such as OpenBSD/FreeBSD/HP-UX).
  • Default php server TCP/UDP ports: none
Read more …
Categories: Linux, Networking, PHP | Tags: command line, Linux, php, rhel

Squid content filtering: Block / download of music MP3, mpg, mpeg, exec files

Posted on January 24, 2013 by Muhamamd Zeeshan
No comments

Q. For security and to save bandwidth I would like to configure Squid proxy server such way that I do not want my users to download all of the following files:
MP3
MPEG
MPG
AVG
AVI
EXE

How do I configure squid content filtering?

A. You can use squid ACL (access control list) to block all these files easily.

How do I block music files using squid content filtering ACL?

First open squid.conf file /etc/squid/squid.conf:

# vi /etc/squid/squid.conf
Now add following lines to your squid ACL section:

acl blockfiles urlpath_regex "/etc/squid/blocks.files.acl"
You want display custom error message when a file is blocked:
# Deny all blocked extension
deny_info ERR_BLOCKED_FILES blockfiles
http_access deny blockfiles

Save and close the file. Read more …

Categories: Linux, Proxy | Tags: centos, Linux, rhel, squid

Install Squid Proxy Server on CentOS / Redhat enterprise Linux 5

Posted on January 24, 2013 by Muhamamd Zeeshan
No comments

Squid server is a popular open source GPLd proxy and web cache. It has a variety of uses, from speeding up a web server by caching repeated requests, to caching web, name server query , and other network lookups for a group of people sharing network resources. It is primarily designed to run on Linux / Unix-like systems. Squid is a high-performance proxy caching server for Web clients, supporting FTP, gopher, and HTTP data objects. Unlike traditional caching software, Squid handles all requests in a single, non-blocking, I/O-driven process. Squid keeps meta data and especially hot objects cached in RAM, caches DNS lookups, supports non-blocking DNS lookups, and implements negative caching of failed requests. Squid consists of a main server program squid, a Domain Name System lookup program (dnsserver), a program for retrieving FTP data (ftpget), and some management and client tools.

Install Squid on CentOS / RHEL 5

Use yum command as follows:
# yum install squid
Output:

Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package squid.i386 7:2.6.STABLE6-4.el5 set to be updated
--> Running transaction check
Dependencies Resolved
=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 squid                   i386       7:2.6.STABLE6-4.el5  updates           1.2 M
Transaction Summary
=============================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 1.2 M
Is this ok [y/N]: y
Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: squid                        ######################### [1/1]
Installed: squid.i386 7:2.6.STABLE6-4.el5
Complete!

Read more …

Categories: Linux, Proxy | Tags: centos, Linux, proxy, squid

Howto: Squid proxy authentication using ncsa_auth helper

Posted on January 24, 2013 by Muhamamd Zeeshan
No comments

For fine control you may need to use Squid proxy server authentication. This will only allow authorized users to use proxy server.

You need to use proxy_auth ACLs to configure ncsa_auth module. Browsers send the user’s authentication in the Authorization request header. If Squid gets a request and the http_access rule list gets to a proxy_auth ACL, Squid looks for the Authorization header. If the header is present, Squid decodes it and extracts a username and password.

However squid is not equipped with password authentication. You need to take help of authentication helpers. Following are included by default in most squid and most Linux distros:
=> NCSA: Uses an NCSA-style username and password file.
=> LDAP: Uses the Lightweight Directory Access Protocol
=> MSNT: Uses a Windows NT authentication domain.
=> PAM: Uses the Linux Pluggable Authentication Modules scheme.
=> SMB: Uses a SMB server like Windows NT or Samba.
=> getpwam: Uses the old-fashioned Unix password file.
=> SASL: Uses SALS libraries.
=> NTLM, Negotiate and Digest authentication

Read more …

Categories: Linux, Networking | Tags: centos, Linux, squid

install perl DBD::Oracle

Posted on December 27, 2012 by Muhamamd Zeeshan
No comments

install perl DBD::Oracle

From the many tales of woe on the web about installing perl DBD::Oracle, from “invalid lvalue in assignment” to mysterious make errors, and the pages of intricate instructions doubtfully translated from the French, I assumed that it was a long and difficult process and it was natural that I was having problems installing on 64-bit CentOS. WRONG! It can actually be easy for lazy and dumb people like me.

First, just use yum and hand-compiling. Don’t add CPAN to the mix.

  1. Add the rpmforge repo and the EPEL repo (see links for instructions) so that you can install perl-DBD and perl-DBI via yum.
  2. Install perl-DBD and perl-DBI via yum.
  3. Download and install the OCI client “basic” and “sdk/devel” packages from Oracle. Note that you might need an older version if you’re connecting to an older version of Oracle. Note also that Oracle makes you log in to download this. Note also that you need both the SDK and the Basic package. I recommend getting the rpms – install with a simple rpm -Uvh .
  4. Oracle puts the libraries in a wacky place, e.g. /usr/lib/oracle/11.2/client64/lib if you’re using the 64-bit version of 11.2. Therefore, create a new file, e.g. oci.conf, in /etc/ld.so.conf.d/, with the library location in it, and then run (as root) ldconfig -v to add it. Read more …
Categories: Linux, Oracle, perl | Tags: centos, cpan, dbd, Linux, oracle, perl, rhel

How do I enable laptop mode to improve Linux laptop battery life?

Posted on November 30, 2011 by Muhamamd Zeeshan
2 comments

Q. I’m using Redhat enterprise Linux desktop / workstation operating system with HP laptop. Several Linux distributions have a / script to enable to disable Laptop mode but Redhat misses the script. How do I enable or disable laptop mode on fly?

A. Modern Linux kernel includes very good support for Laptop mode. It is use to control the IO subsystem. When laptop mode is enabled, the Linux will try to be smart about when to do disk I/O. It gives as much time as possible to be in a low power state. If mode is disabled if value is set to zero (0). To enable mode use non zero value such as 5.

Display or print current Laptop mode

Type the following command:

$ cat /proc/sys/vm/laptop_mode

Output:

0

Turn on or enable Laptop mode

Type the following command as the root user:

OR

# echo 5 > /proc/sys/vm/laptop_mode

 

Categories: Linux | Tags: Linux, Linux Laptop mode

How to send email from the Linux command line

Posted on October 13, 2011 by Muhamamd Zeeshan
6 comments

The Linux command line can be very powerful once you know how to use it. You can parse data, monitor processes, and do a lot of other useful and cool things using it. There often comes a need to generate a report and mail it out. It could be as simple a requirement as a notification that the day’s backup went through fine, or did not. I’ll help you get started with sending mails from the Linux command line and in shell scripts. We will also cover sending attachments from the command line. We will begin with the “mail” command.

MAIL

First run a quick test to make sure the “sendmail” application is installed and working correctly. Execute the following command, replacing “you@youremailid.com” with your e-mail address

# mail -s “Hello world” you@youremailid.com

Hit the return key and you will come to a new line. Enter the text “This is a test from my server”. Follow up the text by hitting the return key again. Then hit the key combination of Control+D to continue. The command prompt will ask you if you want to mark a copy of the mail to any other address, hit Control+D again. Check your mailbox. This command will send out a mail to the email id mentioned with the subject, “Hello world”.

To add content to the body of the mail while running the command you can use the following options. If you want to add text on your own:

# echo “This will go into the body of the mail.” | mail -s “Hello world” you@youremailid.com

And if you want mail to read the content from a file:

# mail -s “Hello world” you@youremailid.com < /home/calvin/application.log

Some other useful options in the mail command are:

-s subject (The subject of the mail)
-c email-address (Mark a copy to this “email-address”, or CC)
-b email-address (Mark a blind carbon copy to this “email-address”, or BCC)

Here’s how you might use these options:

# echo “Welcome to the world of Calvin n Hobbes” | mail -s “Hello world” calvin@cnh.com -c hobbes@cnh.com -b susie.derkins@cnh.com

 

Categories: Linux | Tags: command line, Linux, sendmail

HowTo: Add Jobs To cron Under Linux or UNIX?

Posted on October 8, 2011 by Muhamamd Zeeshan
10 comments

Cron job are used to schedule commands to be executed periodically. You can setup setup commands or scripts, which will repeatedly run at a set time. Cron is one of the most useful tool in Linux or UNIX like operating systems. The cron service (daemon) runs in the background and constantly checks the /etc/crontab file, /etc/cron.*/ directories. It also checks the /var/spool/cron/ directory.

crontab is the command used to install, deinstall or list the tables (cron configuration file) used to drive the cron daemon in Vixie Cron. Each user can have their own crontab file, and though these are files in /var/spool/cron/crontabs, they are not intended to be edited directly. You need to use crontab command for editing or setting up your own cron jobs.

Different Types of cron Configuration

There are two different types of configuration files:

  1. The UNIX / Linux system crontab : Usually, used by system services and critical jobs that requires root like privileges. The sixth field (see below for field description) is the name of a user for the command to run as. This gives the system crontab the ability to run commands as any user.
  2. The user crontabs: User can installer their own jobs using the crontab command. The sixth field is the command to run, and all commands run as the user who created the crontab

How Do I Install / Create / Edit My Own Cronjobs?

To edit your crontab file, type the following command at the UNIX / Linux shell prompt:

$ crontab -e

Syntax of crontab (Field Description)

Your cron job looks as follows for user jobs:

1 2 3 4 5 /path/to/command arg1 arg2

OR
1 2 3 4 5 /root/backup.sh

Where,

  • 1: Minute (0-59)
  • 2: Hours (0-23)
  • 3: Day (0-31)
  • 4: Month (0-12 [12 == December])
  • 5: Day of the week(0-7 [7 or 0 == sunday])
  • /path/to/command – Script or command name to schedule

Easy to remember format:

* * * * * command to be executed
- - - - -
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)

Your cron job looks as follows for system jobs:

1 2 3 4 5 USERNAME /path/to/command arg1 arg2

Example: Install Backup Job Script

If you wished to have a script named /root/backup.sh run every day at 3am, your crontab entry would look like as follows. First, install your cronjob by running the following command:

# crontab -e Append the following entry: 0 3 * * * /root/backup.sh 

Save and close the file.

Categories: Linux | Tags: cron job, cron tab, Linux

Mount an ISO image under Linux

Posted on July 31, 2011 by Muhamamd Zeeshan
4 comments

An ISO image is an archive file (disk image) of an optical disc using a conventional ISO (International Organization for Standardization) format. ISO image files typically have a file extension of .ISO. The name “ISO” is taken from the ISO 9660 file system used with CD-ROM media, but an ISO image can also contain UDF file system because UDF is backward-compatible to ISO 9660.

You can mount an ISO images via the loop device under Linux. It is possible to specify transfer functions (for encryption/decryption or other purposes) using loop device.

But, how do you mount an ISO image under Linux? You need to use mount command as follows:

Procedure to mount ISO images under Linux

1) You must login as a root user, if not root user then switch to root user using following command:
$ su –

2) Create the directory i.e. mount point:
# mkdir -p /mnt/disk

3) Use mount command as follows to mount iso file called disk1.iso:
# mount -o loop disk1.iso /mnt/disk

4) Change directory to list files stored inside an ISO image:
# cd /mnt/disk
# ls -l

More about loop device

A loop device is a pseudo-device that makes a file accessible as a block device. Loop devices are often used for CD ISO images and floppy disc images. Mounting a file containing a filesystem via such a loop mount makes the files within that filesystem accessible. They appear in the mount point directory using above commands.

Categories: Linux | Tags: iso image, Linux, mount iso
  • Recent Posts

    • Samsung Galaxy S7 rumor roundup: price, release date, features, specs
    • How to Root any LG Mobile
    • How To Record Ptcl Smart TV(iPtv) channels on PC
    • How to change the interface metric from GUI?
    • What’s the recommended way to enable / disable services in Ubuntu?
  • Categories

    • Android
    • Android_News
    • Android_Root
    • CCNA urdu
    • Cisco
    • internet
    • iptv
    • ipv6
    • Linux
    • Networking
    • Oracle
    • perl
    • PHP
    • Proxy
    • ptcl smarttv
    • Ubuntu
    • unblock
    • Uncategorized
    • urdu_tutorials
    • Windows
  • Tags

    bad username password ccna centos cisco command line configuration register cpan cron job cron tab dbd facebook get ipv6 free internet iptv ipv6 iso image ithut.net line attenuation Linux Linux Laptop mode mount iso networking oracle perl php proxy ptcl ptcl smart tv rhel sendmail smarttv snr margin squid Tutorials ubuntu unblock facebook unblock youtube urdu Urdu Tutorials utdu windows windows 7 windows xp youtube zee.im
zee.im ithut.net