December 13, 2009 | Posted by
admin | Category: Linux Administration
How to check the version of Debian OR Ubuntu OS?
To find out the version of Debian OS you are running, execute
# cat /etc/debian_version
There are 2 ways to find out the version of Ubuntu OS you are running.
1. Check the file /etc/issue and the output will be something like:
# cat /etc/issue
Debian GNU/Linux 5.x
2. Execute the lsb_release command:
# lsb_release -a
Distributor ID: Debian
Description: Debian GNU/Linux 5.x (lenny)
Release: 5.x
Codename: lenny
Comments Off on How to check the version of Debian or Ubuntu OS?
December 6, 2009 | Posted by
admin | Category: Linux Administration
How to create a .tar, .tar.gz and .tar.bz2 file?
# tar -cf example.tar example
# tar -zcf example.tar.gz example
# tar -jcf example.tar.bz2 example
root@server [~]# ll
drwxr-xr-x 2 root root 4096 Dec 6 07:02 example/
-rw-r–r– 1 root root 30720 Dec 6 08:11 example.tar
-rw-r–r– 1 root root 912 Dec 6 08:11 example.tar.bz2
-rw-r–r– 1 root root 659 Dec 6 08:11 example.tar.gz
How to extract a .tar, .tar.gz and .tar.bz2 file?
# tar -xf example.tar
# tar -zxf example.tar.gz
# tar -jxf example.tar.bz2
If you use ‘v’ switch in the above examples, it will display detail message during the command execution.
How to compress a file using zip, gzip and bzip2?
# zip file.zip file
# gzip file
# bzip2 file
root@server [~]# ll
-rw-r–r– 1 root root 14 Dec 6 08:16 file.bz2
-rw-r–r– 1 root root 25 Dec 6 08:15 file.gz
-rw-r–r– 1 root root 140 Dec 6 08:15 file.zip
How to extract zip, gzip and bzip2 compressed files?
# unzip file.zip
# gunzip file.gz
# bzip2 -d file.bz2
With gunzip and bzip2, the files will be extracted but you will no longer have the compressed file.
Comments Off on How to create archives and compressed files?
December 1, 2009 | Posted by
admin | Category: Linux Administration
How to Turn off Mod Security OR How to disable Mod Security for an account?
Mod_Security for an account is turned off/disabled on depending upon the version of Mod_Security i.e. it can be disabled in .htaccess file in modsecurity1 and have to disable it in VirtualHost entry of a domain in modsecurity2. Apache 1.x supports Mod Security1 and Apache 2.x supports Mod Securiry2. To find out the version of Apache, execute
httpd -v
Mod Security1:
Create a .htaccess file in an account
vi .htaccess
and insert the following:
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
Mod Security2:
You cannot disable mod security in a .htaccess file here (it’s setup this way to enhance security). You have to turn off mod security in the VirtualHost of the domain in the Apache configuration file. Edit the configuration file:
vi /etc/httpd/conf/httpd.conf
scroll down to the VirtualHost of the domain and place the following lines:
<IfModule mod_security2.c>
SecRuleEngine Off
</IfModule>
Save the configuration file and restart the Apache service.
service httpd restart
Comments Off on Howto: disable Mod Security for an account
November 29, 2009 | Posted by
admin | Category: Linux Administration
How to Disable Directory Listing? You may want to hide directory listings because by default Webservers look for an index file under every directory and if not found, they list the files and directories under it on browsing the directory.
To disable Directory Listing for an account recursively:
1) Create a .htaccess file under the directory
vi .htaccess
2) Add Options directive as follows:
Options -Indexes
3) Save the file.
You now will see a Forbidden message on accessing a directory that do not include an index file.
November 22, 2009 | Posted by
admin | Category: Linux Administration
How to change Port speed OR Network Interface Speed?
To set a specific speed limit on a Network Interface say 10mbps, edit the file network interface file and set the limit which will make the changes permanent even after a reboot.
Edit the file:
root@server [~]# pico /etc/sysconfig/network-scripts/ifcfg-eth0
Add the following line at the end of the file:
ETHTOOL_OPTS=”speed 10 duplex full autoneg off”
Save the file and restart the network service.
root@server [~]# service network restart
This way you can set the duplex or auto negotiation as well. Once done, you can check the network speed using the ethtool command
root@server [~]# ethtool eth0