Syed Jahanzaib Personal Blog to Share Knowledge !

October 19, 2012

Howto mount windows shared folder in Ubuntu

Filed under: Linux Related — Tags: , — Syed Jahanzaib / Pinochio~:) @ 11:00 AM

First create a folder where you want to mount windows folder in. Then mount the target windows shared folder in it using below commands.

mkdir /mnt/winfolder
mount -t cifs // /mnt/winfolder -o username=zaib,password=mypassword,domain=mydomain


# is Windows System where our required folder is shared

# change the user name , password, and domain as per your local settings.


October 10, 2012

October 8, 2012

SQUID URL Redirection

Filed under: Linux Related — Tags: , , , — Syed Jahanzaib / Pinochio~:) @ 9:11 AM

Following is a method to redirect any URL to another URL. for example if you want that when user opens , he must be redirected to , you can use the following simple PHP redirector to fulfill this requirement.

First Add the redirector location in squid.conf

nano /etc/squid/squid.conf

url_rewrite_program /etc/squid/url_redirect.php
 url_rewrite_children 5

Save & Exit.

Now create the url redirector by

nano /etc/squid/url_redirect.php

# Syed Jahanzaib / /
# Squid URL Rewrite program : Codes picked from the internet.

 $temp = array();

 while ( $input = fgets(STDIN) ) {
 // Split the output (space delimited) from squid into an array.
 $temp = split(' ', $input);

 // Set the URL from squid to a temporary holder.
 $output = $temp[0] . "\n";

 // Clean the Requesting IP Address field up.
 $ip = split('/',rtrim($temp[1], "/-"));

 if (preg_match("/^http:\/\/", $temp[0])) {
 $output = "301:\n";

 echo $output;

Save & Exit.

Assign execute permission by

chmod +x /etc/squid/url_redirect.php

Now restart / recon squid service and from client end try to open & you will be redirected to transparently :)~



Before URL Redirection , squid log showed TCP_MISS/200 71205 GET – DIRECT/ text/html

After URL Redirection, squid log showed

1 TCP_MISS/301 309 GET – NONE/- TCP_MISS/200 74892 GET – DIRECT/ text/html





Syed Jahanzaib

%d bloggers like this: