Tuesday, December 16, 2008

Burn an ISO image to a CD right from the command line!


This is commonly used by system administrators who love simple, efficient and verbose method of writing an image into a Compact Disk. If you have an ISO file "image.iso", then you can use the "cdrecord" command:
cdrecord -v speed=8 dev=/dev/cdrom /path/to/image.iso
Attributes:

-v : Verbose mode, shows a lotta information while writing the disk.. geeky :-D
speed = : you can set the burning speed. 8 means 8x speed
-multi : multisession mode (ooooh, cool feature for a command line tool)

Listing files in Linux sorted according to size


Have you ever felt the need to list the 10 files that takes the largest space in a specific directory? You might know that its pretty easy do that via GUI but believe me its the same thing when it comes to the Console also.

Here is how its done:
du -a (directory) | sort -n -r | head -n 10
This will list all the files in the directory specified, sorts them and lists the 10 files that takes up maximum size.

Easy, right?

Tuesday, December 2, 2008

Make files in your webserver download instead of being displayed


Suppose, you have a text file in your web directory. When you access that file, it will be displayed in the web browser itself. If you want to make that file (or any other file type you want) to be asked to download instead of being displayed, here is what you can do:

Create a .htaccess file in that directory with the following content:
AddType unknown/nothing pdf
AddType unknown/nothing txt
AddType unknown/nothing jpg
Now when you access any file with an extension .jpg or .pdf, your browser will ask you to download the file instead of showing up.

Relaying email from Postfix via another SMTP Server


Have you ever been in a situation where you want to relay your emails from your Postfix server via another SMTP server? This is certainly possible and its way too simple:

First thing to do is configure Postfix in your machine. Once done, edit the configuration file for Postfix (usually under /etc/main.cf) and editing the below value:

#relayhost =

to

relayhost = smtp.emailprovider.com

Once done, all emails sent via your Postfix server will be relayed through the desired Outgoing server.

Other options that may interest you are as follows:
  • myhostname = hostname.emailprovider.com
  • mydomain = emailprovider.com
  • masquerade_domains = emailprovider.com
The last option will correct the envelopes shows as "user@emailprovider.com".

Hope that helps someone :-)

Monday, December 1, 2008

Limiting Denial of Service (DoS) attacks


Denial of Service (DoS) attack is an attempt by a malicious (or unwitting) user, process, or system to prevent legitimate users from accessing a resource (usually a network service) by exploiting a weakness or design limitation in an information system. Examples of DoS attacks include flooding network connections, filling disk storage, disabling ports, or removing power. This can be limited by setting timeouts.
  • # echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout
  • # echo 1800 > /proc/sys/net/ipv4/tcp_keepalive_time
  • # echo 1 > /proc/sys/net/ipv4/tcp_window_scaling
  • # echo 0 > /proc/sys/net/ipv4/tcp_sack
  • # echo 1280 > /proc/sys/net/ipv4/tcp_max_syn_backlog

Source: http://sourcelinux.wikidot.com/firewall-using-iptables
 

A Linux Admin's WeBlog! Blak Magik is Designed by productive dreams for smashing magazine Bloggerized by Ipiet The Blog Full of Games © 2008