Wednesday, February 22, 2012

How to access NTFS partition in Rhel/Centos 5/6

The primary step for enabling NTFS Support for the CentOS Linux / RHEL edition 5.x and 6.x is to install the EPEL repository onto the server.
Use the below command to install EPEL repository in CentOS or RHEL versions

$ cd Download
$ wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm
# rpm -ivh epel-release-6-5.noarch.rpm

You must be logged in as Root for the below command to work :

# yum install ntfs-3g
Checking the Name of an NTFS Partition

Entering the below commands would help you determine the name of an NTFS partition :
# fdisk -l /dev/sda
# fdisk -l /dev/sdb
Steps to Mount /dev/sda1 NTFS Partition at /mnt/ntfs

It is essential to load the fuse driver. The below command should help you do that :
# modprobe fuse

Now using the below command you must build a mount point:
# mkdir /mnt/ntfs

The following command would help you with mounting the ntfs partition :
# mount -t ntfs-3g /dev/sda1 /mnt/ntfs

Command for Unmounting the NTFS Partition

# umount /mnt/ntfs

Tuesday, February 21, 2012

How to configure ACL in Linux

ACLs can be configured:

 1.Per user
2. Per group
3.Via the effective rights mask
4.For users not in the user group for the file

Enable ACL support on the partition.
Edit /etc/fstab file and change the default parameter to rw,acl
If we want to enable acl for /mnt







Now, you will need to remount the /mnt partition with the "acl" option. The easiest way to do this is with the "remount" option, since it will work even while the partition is in use:

[root@vishal /]# mount -v -o remount /mnt/
/dev/sda5 on /mnt type ext3 (rw,acl)

Create a user and group:-
 [root@vishal /]# useradd vishal
[root@vishal /]# groupadd linux
[root@vishal /]# usermod -a -G linux vishal

Now, we can actually start using ACLs. The basic commands that we are interested in are:
getfacl
setfacl


[root@vishal /]#  setfacl -m u:vishal:rw- /mnt/
[root@vishal /]#  getfacl /mnt/
getfacl: Removing leading '/' from absolute path names
# file: mnt
# owner: root
# group: root
user::rwx
user:vishal:rw-
group::r-x
mask::rwx
other::r-x

To remove all the permissions for a user, group, or others, use the -x option and do not specify any permissions:
[root@vishal /]# setfacl -x rules files

Thanks,
Vishal Vyas

Friday, February 10, 2012

Configure SSL Apache on Ubuntu...

Generate a Self-Signed Certificate:-










 $a2enmod ssl 
$mkdir /etc/apache2/ssl 
$openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/ssl.pem -keyout /etc/apache2/ssl/ssl.key

You will be asked for several configuration values. Enter values appropriate for your organization and server, as shown here.

Generating a 1024 bit RSA private key
.++++++
..............................++++++
writing new private key to '/etc/apache2/ssl/ssl.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:IN
State or Province Name (full name) [Some-State]:Gujarat
Locality Name (eg, city) []:Ahmedabad
Organization Name (eg, company) [Internet Widgits Pty Ltd]:VishalVyas Ltd
Organizational Unit Name (eg, section) []:Web Dept
Common Name (eg, YOUR name) []:Vishal Vyas
Email Address []:vishal.gtpl@gmail.com


Open /etc/apache2/ports.conf
NameVirtualHost 192.168.1.1:443
or
NameVirtualHost *:443

Replace "192.168.1.1" with your Linode's IP address.

Now open Apache virtual hosting file

vim /etc/apache2/sites-available/vishalvyas.com

<VirtualHost *:443>  Or  <VirtualHost 192.168.1.1:443>
     SSLEngine On
     SSLCertificateFile /etc/apache2/ssl/ssl.pem
     SSLCertificateKeyFile /etc/apache2/ssl/ssl.key
   ServerAdmin info@vishalvyas.com
   ServerName vishalvyas.com
   DocumentRoot /var/www/html/vishal
 </VirtualHost>

Restart Apache:

/etc/init.d/apache2 restart

You should now be able to visit your site with SSL enabled (after accepting your browser's warnings about the certificate).

Thanks,
Vishal

Saturday, February 4, 2012

Apache Tomcat in ubuntu

Ddownload Tomcat  http://tomcat.apache.org/




Unzip it with tar -zxvf  Tomcatxxx.tar
tar -zxvf apache-tomcat-7.0.25.tar.gz

No make or configuration required, just change to tomcat bin folder to start or stop Tomcat



For Staring Tomcat:
sudo /opt/tomcat7/bin/startup.sh

To Shutdown Tomcat:
sudo /opt/tomcat7/bin/shutdown.sh

Done .... !!!!!

Thanks,
Vishal


Friday, February 3, 2012

How to add Virtual Hosts to Apache on Ubuntu

Apache virtual host, as explained by Apache, refers to the practice of running more than one web site (such as www.site1.com and www.site2.com) on a single machine. Virtual hosts can be “IP-based” or “name-based”. By default, Ubuntu already has this capability enabled, so things are much easier to configure these days..


cd /etc/apache2/sites-available


sudo vim vishalvyas.com.conf and enter your VirtualHost directive. Below I've put the most basic example, see Apache docs for details and additional features:

<VirtualHost *:80>
   ServerName vishalvyas.com
   DocumentRoot /home/vishal/vyas_html
</VirtualHost>

Save & exit.

sites-available: this directory has configuration files for Apache2 Virtual Hosts. Virtual Hosts allow Apache2 to be configured for multiple sites that have separate configurations.

sites-enabled: like mods-enabled, sites-enabled contains symlinks to the /etc/apache2/sites-available directory. Similarly when a configuration file in sites-available is symlinked, the site configured by it will be active once Apache2 is restarted.

sudo vim /etc/hosts and add your new domain to the 127.0.0.1 localhost line so it looks like this:
127.0.0.1 localhost vishalvyas.com

Save & exit.

Enable your new virtualhost:
sudo a2ensite vishalvyas.com.conf

Reload the Apache configuration:
sudo /etc/init.d/apache2 reload

Repeat for each of your VirtualHosts.

Thanks,
Vishal

Install Darkstat - a network traffic analyzer

Darkstat is a opensource network monitoring tool, It is a packet sniffer which runs as a background process and serves its statistics to a ...