Best Linux / UNIX Posts of 2007: Part ~ IV

Posted on in Categories News last updated December 31, 2007

The best and top most posts of year 2007 that were emailed / viewed and printed by our readers over the year (part IV of IV):

=> Howto: Connect MySQL server using C program API under Linux or UNIX
=> Howto Linux rename multiple files at a shell prompt
=> Linux password manager that also works under Windows / OS X
=> Howto Backup PostgreSQL Databases Server With pg_dump command
=> FreeBSD reset or recover root password
=> Linux wget your ultimate command line downloader
=> Comparison: Linux vs FreeBSD (Bsd) oses
=> Browse a Samba or MS Windows share in Nautilus
=> OpenSSH deny or restrict access to users and groups
=> Installing and configuring lighttpd webserver – HOWTO
=> Shell script to watch the disk space
=> Linux Setting processor affinity for a certain task or process
=> Download of the day: Fedora core live CD
=> Linux Shutdown Command and Logfile
=> How do I create CD / DVD database Labels in OpenOffice.Org under Linux / Mac OS X / Windows?
=> Extract and decompile .chm file to view as html file under Linux
=> How to use rsync for transferring files under Linux or UNIX
=> Speed up Apache 2.0 web access or downloads with mod_deflate
=> How much RAM does my Ubuntu / Fedora Linux desktop PC have?
=> Monitoring hard disk health with smartd under Linux or UNIX operating systems
=> Zipping and Unzipping Files under Linux
=> Linux Postfix mail server SSL certificate installations and configuration

Thank you for all your support in 2007. I hope you enjoy this site! What else would you like to see on nixCraft? What you like, do not like or anything you feel I should improve on, please let me know in the comments.

Once again, a very happy and prosperous 2008 for all of you. Cheers!

Best Linux / UNIX Posts of 2007: Part ~ III

Posted on in Categories News last updated December 31, 2007

The best and top most posts of year 2007 that were emailed / viewed and printed by our readers over the year (part III of IV):

=> Installing VMWARE server on CentOS 5 or Red hat enterprise Linux 64 bit version
=> 10 boot time parameters you should know about the Linux kernel
=> Test mail server for an open relay
=> Linux Iptables open Bittorrent tcp ports 6881 to 6889
=> What is /dev/shm and its practical usage
=> Monitor and restart Apache or lighttpd webserver when daemon is killed
=> Linux last reboot time and date find out
=> 9 Tips to diagnose remote GNU/Linux server network connectivity issues
=> Howto: Performance Benchmarks a Web server
=> Linux: How to Encrypt and decrypt files with a password
=> How to keep a detailed audit trail of what’s being done on your Linux systems
=> Copy MySQL database from one server to another remote server
=> How to: Recovering Linux grub boot loader password
=> Linux Iptables: How to specify a range of IP addresses or ports
=> SSH Public key based authentication – Howto
=> Lighttpd FasCGI PHP, MySQL chroot jail installation under Debian Linux
=> Linux hard drive benchmark & bottleneck testing software suite for performance
=> Redhat Enterprise Linux securely mount remote Linux / UNIX directory or file system using SSHFS
=> How do I test if my Linux server SCSI / SATA hard disk going bad?

How to: Restrict Users to SCP and SFTP and Block SSH Shell Access with rssh

Posted on in Categories Howto, Linux, RedHat/Fedora Linux, Security, Sys admin, Tips, UNIX last updated December 31, 2007

FTP is insecure protocol, but file-transfer is required all time. You can use OpenSSH Server to transfer file using SCP and SFTP (secure ftp) without setting up an FTP server. However, this feature also grants ssh shell access to a user. Basically OpenSSH requires a valid shell. Here is how sftp works:

SCP/SFTP -> SSHD -> Call sftpd subsystem -> Requires a shell -> User can login to server and run other commands.

In this article series we will help you provide secure restricted file-transfer services to your users without resorting to FTP. It also covers chroot jail setup instructions to lock down users to their own home directories (allow users to transfer files but not browse the entire Linux / UNIX file system of the server) as well as per user configurations.

rssh ~ a restricted shell

rssh is a restricted shell for use with OpenSSH, allowing only scp and/or sftp. It now also includes support for rdist, rsync, and cvs. For example, if you have a server which you only want to allow users to copy files off of via scp, without providing shell access, you can use rssh to do that.

Supported operations using rssh

Restricted shell only allows following operations only:

  • scp – Secure file copy
  • sftp – Secure FTP
  • cvs – Concurrent Versions System ~ you can easily retrieve old versions to see exactly which change caused the bug
  • rsync – Backup and sync file system
  • rdist – Backup / RDist program maintains identical copies of files on multiple hosts.

Install rssh

CentOS / Fedora / RHEL Linux rssh installation

Visit Dag’s repo to grab rssh package
# cd /tmp
# wget http://dag.wieers.com/rpm/packages/rssh/rssh-2.3.2-1.2.el5.rf.i386.rpm
# rpm -ivh rssh-2.3.2-1.2.el5.rf.i386.rpm

Debian / Ubuntu Linux rssh installation

Use apt-get command:
$ sudo apt-get install rssh

FreeBSD installation

# cd /usr/ports/shells/rssh
# make install clean

Make sure you build binary with rsync support.

rssh configuration file

  • Default configuration file is located at /etc/rssh.conf (FreeBSD – /usr/local/etc/rssh.conf)
  • Default rssh binary location /usr/bin/rssh (FreeBSD – /usr/local/bin/rssh)
  • Default port none – ( openssh 22 port used – rssh is shell with security features)

Best Linux / UNIX Posts of 2007: Part ~ II

Posted on in Categories News last updated December 30, 2007

The best and top most posts of year 2007 that were emailed / viewed and printed by our readers over the year (part II of IV):

=> Sending email or mail with attachment from command or shell prompt
=> Recover MySQL root password
=> Configure static routes in Debian or Red Hat Linux systems
=> Linux Get list of installed software for reinstallation / restore software
=> Howto: Configure Linux Virtual Local Area Network (VLAN)
=> PHP send email using authenticated smtp server in real time
=> Understanding UNIX / Linux file system
=> Howto: Linux write (burn) data to DVD or DVD/RW
=> Ubuntu Linux Live CD: Save data & desktop information on USB device
=> Schedule Windows server to reboot or shutdown automatically
=> Linux remote desktop for controlling windows XP desktop
=> Howto: build Linux kernel module against installed kernel w/o full kernel source tree
=> Killing zombie process
=> Perl script to monitor disk space and send an email
=> Linux ultra fast command line download accelerator
=> Moving Outlook email (data) to Linux Evolution mail client
=> How to: Compile Linux kernel 2.6
=> How to extract an RPM package without installing it
=> Howto: Linux kill and logout users
=> Linux audit files to see who made changes to a file

sed tip: Remove / Delete All Leading Blank Spaces / Tabs ( whitespace ) From Each Line

Posted on in Categories Howto, Linux, Shell scripting, UNIX last updated December 30, 2007

The sed (Stream Editor) is very powerful tool. Each line of input is copied into a pattern space. You can run editing commands on each input line to delete or change the input. For example, delete lines containing word DVD, enter:
cat input.txt | sed ‘/DVD/d’

To Print the lines between each pair of words pen and pencil, inclusive, enter:
$ cat input.txt sed -e '/^PEN/,/^PENCIL/p'

To remove all blank lines, enter:
$ cat /etc/rssh.conf | sed '/^$/d' > /tmp/output.file

sed is very handy tool for editing and deleting unwanted stuff. Following echo statements printed lots of whitespace from left side:
echo "     This is a test"
Output:

         This is a test

To remove all whitespace (including tabs) from left to first word, enter:
echo "     This is a test" | sed -e 's/^[ \t]*//'
Output:

This is a test

Where,

  • s/ : Substitute command ~ replacement for pattern (^[ \t]*) on each addressed line
  • ^[ \t]* : Search pattern ( ^ – start of the line; [ \t]* match one or more blank spaces including tab)
  • // : Replace (delete) all matched pattern

Following sample script reads some data from text file and generate a formatted output. It delete all leading whitespace from front of each line so that text get aligned to left:

#!/bin/bash
FILE=url.dump.txt
DOMAIN=yourdomain.com
exec 3<&0
exec 0<$FILE
while read line
do
	url=$(echo "http://${DOMAIN}${line}")
        title="$(lynx -dump -source ${url} | grep '<title>' | awk -F '<title>' '{ print $2 }' | cut -d'<' -f1|sed 's/^[ \t]*//')"
        echo "<li>${title}</li>"
done
exec 0<&3

To delete trailing whitespace from end of each line, enter:
$ cat input.txt | sed 's/[ \t]*$//' > output.txt
Better remove all leading and trailing whitespace from end of each line:
$ cat input.txt | sed 's/^[ \t]*//;s/[ \t]*$//' > output.txt

Best Linux / UNIX Posts of 2007: Part ~ I

Posted on in Categories News last updated December 30, 2007

The best and top most posts of year 2007 that were emailed / viewed and printed by our readers over the year:

=> Resize Windows Partition with Open Source Software
=> Linux: Setup a transparent proxy with Squid in three easy steps
=> How do I find out Linux CPU utilization?
=> How Do I Enable remote access to MySQL database server?
=> Howto: Ubuntu Linux convert DHCP network configuration to static IP configuration
=> Linux > Command line BitTorrent client
=> Download of the day: AcetoneISO – extract, browse ISO and other CD/DVD formats under Linux
=> Howto install & use Flash, Java, Real Player 32 bit plugins under 64 bit Firefox
=> Samba share permissions simplified
=> Linux install and configure DLink DWL g 520 – RT61 Wireless LAN PCI Card
=> Linux configure point to point tunneling PPTP VPN client for Microsoft PPTP vpn server
=> Linux add ethtool duplex settings to a network card permanently
=> How to: Change / Setup bash custom prompt (PS1)
=> How to mount remote windows partition (windows share) under Linux
=> How to: Mount an ISO image under Linux
=> How to backup MySQL databases, web server files to a FTP server automatically
=> Linux bond or team multiple network interfaces (NIC) into single interface
=> Fix a dual boot Windows Vista and Linux problem
=> Ubuntu Linux NFS Client Configuration to mount nfs share
=> Sending email or mail with attachment from command or shell prompt

Clonezilla Ghost Like Linux Partition or Disk Clone Software

Posted on in Categories Data recovery, Download of the day, File system, Hardware, Howto, Linux, Linux desktop, UNIX, Windows, Windows server last updated December 28, 2007

You can easily clone single hard disk or partition using netcat and your own network. However, software such as Clonezilla offers a partition or disk clone software similar to Ghost. It saves and restores only used blocks in hard drive.

Norton Ghost is popular proprietary commercial software. It is slow and takes lots of time to clone system. There is also Symantec Ghost Corporate Edition with multicasting and fast cloning system.

However, Clonezilla is a free, open source, multitasking and multi operating system software. With DRBL (Diskless Remote Boot in Linux [DRBL] provides a diskless or systemless environment for client machines) and network boot enabled client computers, the only thing you have to prepare is a Clonezilla server. The best thing is ~ you do not even have to prepare a bootable CD or floppy with Partition Image for every client computer.


Clonezilla Ghose like Linux partition or disk clone software in action
(Fig 01: Starting Clonezilla Clone Software)

Clonezilla Ghost like Linux partition or disk clone software
(Fig 02: Clonezilla and DRBL running under Ububtu Linux ~ click to enlarge image)

Download Clonezilla cloning software

=> Visit official project home page to download Clonezilla software.

How to: Setting up a Clonezilla/DRBL server on Ubuntu 7.04

=> A simple howto on setting up Clonezilla/DRBL on Ubuntu Linux

How to: Setting up a Clonezilla/DRBL server on CentOS / Fedora / RHEL

=> A simple documentation to quickly setup up Clonezilla on a PXE server.

Related tutorials / software:

How to edit GRUB Settings with GUI tool QGRUBEditor

Posted on in Categories Download of the day, GNU/Open source, Howto, Linux, Linux desktop last updated December 28, 2007

There is a tiny little program called QGRUBEditor. It is a system GUI tool to view and edit the GRUB boot loader. It offers many features and it is the perfect solution for those who want to change the way GRUB works, without messing with GRUB’s configuration files. This is an excellent tool for a new user.

From the article:

If you’ve been running Linux long enough to have upgraded your system more than once, you probably have several Linux kernels lurking around your system. If you discover that a certain application no longer works for you, you can go back to a previous kernel to try to run your program. GRUB, the boot loader found in most Linux distributions, lets you choose among operating systems and kernels installed on your box. Many people, however, fear that messing with GRUB may ruin their system, because of its many esoteric options, and configuration file text that often contains no help comments. QGRUBEditor can help you view and edit the GRUB boot loader from a graphical user interface.

QGRUBEditor - A visual GUI GRUB configuration editor
(Fig 01: QGRUBEditor in action [image credit official project home page] )

Download QGRUBEditor ~ A visual GUI GRUB configuration editor

Visit official project page to download QGRUBEditor (Found via Linux.com )

Digital Electronic Stethoscope Powered by uClinux ( Embedded Linux ) Distribution

Posted on in Categories Hardware, Linux, Linux distribution, Linux Embedded devices, News last updated December 26, 2007
uClinux - Embedded Linux/Microcontroller Project Logo

A team of electrical and computer engineering students at Calvin College is designing a digital electronic stethoscope running uClinux (pronounced “you-see-linux”) as its operating system. The team has chosen the Coldfire MCF5275 Microprocessor from Freescale. This is a 32-bit microprocessor with built-in USB Device, Ethernet, harware encryption, and eMAC. The eMAC (Enhanced Multiply Accumulate Unit) allows the processor to perform the intensive calculations required to do digital filtering and audio compression.The team has decided to use µClinux as the project operating system. µClinux is a very small (1 MB) open-source Linux operating system that will run from flash memory. The team has successfully compiled the µClinux kernel and is running it on the development board.

Digital electronic stethoscope powered by uClinux ( Embedded Linux ) distribution
(Fig 01: Simple, accurate, and easy to use electronic stethoscope! [Image credit – project home page])

The device is in its early stages of development and the project proposal and feasibility study is completed.

=> An electronic stethoscope powered by uClinux (via ./)