وفاة الشيخ الأمير الوالد سعد العبدلله الصباح اليوم

Posted by: Mo Mughrabi No Comments »

الشيخ سعد

{ يا ايتها النفس المطمئنه ارجعي الى ربك راضية مرضيه فادخلي في عبادي وادخلي جنتي } صدق الله العظيم
انتقل الى رحمة الله تعالى الشيخ الأمير الوالد سعد العبدلله السالم الصباح اليوم
داعين الله عز وجل أن يتغمد الفقيد بواسع رحمته ويسكنه فسيح جناته

Blood bank in Urood

Posted by: Mo Mughrabi No Comments »

Yesterday Urood team started something extremely useful here in Kuwait. Its not just a brilliant idea but its truly creative and it came when most needed. Ever now and then I see posts and ads about blood donations and how it may save lives! Urood came up with a new section “Community service” part of the community service is the blood bank link.

All you have to do is, click on the link and type write your information and blood type. so, if someone is in emergency they can look up matches on Urood. I think, this is wonderful and everyone should participate in this great humanitarian service

click here to start input or searching for a match
or just click here to view Urood home page

Have a great day every one,

Creating web interface to access your remote Linux servers

Posted by: Mo Mughrabi No Comments »

Its been a while since last I’ve posted anything but am here trying to keep up with many websites. Any who, Recently I was requested by one of my clients to create a web interface to help the none technical restart apache, mysql and do some monitoring on different servers.

so, first what I did is generate a key to create secure channels between the servers in order to connect without prompting for password (click here for steps). Then, I faced some trouble writing the PHP code which will connect and do these tasks and after long day of surfing and some help from my team (Basant) we finally nailed it.

First, you will need to install openssl (openssl-devel), then download and compile libssh2 and then you will need to add the extension in your PHP.ini (click here for PHP ssh2 installation manual) and here is a sample code on how it can be done in PHP.


// Notify user if the server terminates the connection
function my_ssh_disconnect($reason, $message, $language) {
printf("Server disconnected with reason code [%d] and message: %s\n",
$reason, $message);
}

$methods = array(
'kex' => ‘diffie-hellman-group1-sha1′,
‘client_to_server’ => array(
‘crypt’ => ‘3des-cbc’,
‘comp’ => ‘none’),
’server_to_client’ => array(
‘crypt’ => ‘aes256-cbc,aes192-cbc,aes128-cbc’,
‘comp’ => ‘none’));

$callbacks = array(’disconnect’ => ‘my_ssh_disconnect’);

$connection = ssh2_connect(’domain_name.com’, 22, $methods, $callbacks) or die(’Couldnot locate the ssh2′);
if (!$connection) die(’Connection failed’);
if (ssh2_auth_password($connection, ‘linux_user’, ‘linux_password’)) {
echo “Authentication Successful!\n\n”;
$shell=ssh2_shell($connection, ‘bash’) or die(”error”);
// fwrite will send execute commands and return value in $shell
fwrite( $shell, “/etc/init.d/httpd restart\n”);

// this will look the $shell array and print the returned value.
while($line = fgets($shell)) {
flush();
echo $line.”
“;
}

fclose($shell); // close connection
}else{
echo “Error with connection\n”;
}

?>

KwtLinux on facebook

Posted by: Mo Mughrabi No Comments »

I just finished creating KwtLinux group on facebook as its will help in spreading the word. Specially that facebook has become one of the largest communities packed with users from Kuwait, If you are a facebook member you can go ahead and join us here.

Mounting remote folder (Fedora)

Posted by: Mo Mughrabi No Comments »

If you are working with servers, you probably came through this issue before. Let’s say you have two servers and you need to setup an automated backup or you want to share files from different server yet you want to save time writing scripts to pull the files or push the backup through FTP. Mounting a remote folder will save you lots of time since the mounted folder will act like a local folder and all you have to do is move or copy your files to the local path and its will be placed on the remote server. so, its useful for many uses and here is the steps on how to set it up on a linux fedora.

First, you will need to install the required package
yum install fuse
yum install fuse-sshfs

Then, grant the user access to the fuse group
usermod -G fuse linuxuser Replace linux user with your linux user

Now, you are ready to issue the command which will mount the remote folder on your current system.
sshfs -o nonempty 192.0.0.1:/remote_folder/full/path /local_folder/full/path

Where nonempty means that the remote folder is not empty
192.0.0.1 is the remote server IP address (local network or over the internet)
/remote_folder/full/path is the full path for the remote folder
/local_folder/full/path is the full path for the local folder to mount on (folder should be created first)

Put on your questions in the comment section if you have any & hope have fun networking,
Have a good day all,

Update: If you wish to unmount the folder you can use the following command
fusermount -u /local_folder/full/path

Alienware, Power your linux

Posted by: Mo Mughrabi No Comments »

Alienware Area-51 7500
Recently I’ve been looking up desktop’s to use with Linux & for gaming purposes. & I came across Alienware which is extremely powerful for personal desktops, as I wondered around reading about Alienware I came to know that they been around for sometime now. Most review shows that people are highly satisfied with Alienware performance specially with Ubuntu graphical interface & since most Alienware running at least a NVIDIA® SLI™ Dual Graphics which makes the Ubuntu experience superb.

Alienware desktops starts at 1,199$ with the Area-51 7500 & can goes up till 5,149$ with the Area-51 ALX Crossfire. Also it comes with Windows Vista of your choice & can easily be replaced with your favorite linux distribution off course. You can see a list of all the Alienware desktops here or list of the laptops here.

Hacking PDF Passwords with Ubuntu

Posted by: Soul 6 Comments »

You guys might have encountered PDF files with password protection sometime or the other.

Its easier to hack those password protected files now with UBuntu.

You wouldnt be needing those KD sucking software anymore.

Go to console/terminal, type the following code.

$ pdftops protected.pdf out.ps
$ pstopdf out.ps out.pdf

Where,

protected.pdf is the protected PDF file

out.ps is an intermediate output of the protected PDF file

out.pdf is the final cracked PDF file

Thats it for the day. More hacks to come.

Download queue script

Posted by: Mo Mughrabi No Comments »

This script is one of my fav, am sure there is many times when you wish you could place things in queue & return and see all your files ready. Specially, if you are running a server remotely or if you not using any GUI. This script I usually run in case I have list of large files over the Internet and need to download them without having to set in front of the computer to submit each file.

First, you will need to get all the files in a text file (notepad) here is an e.g

http://kwtlinux.com/file1.zip
http://kwtlinux.com/file2.zip
http://kwtlinux.com/file3.zip
http://kwtlinux.com/file4.zip

Save the the text file an lets call it queue.txt, now you will need to write a small set of command to read from the file and begin downloading.


for i in `cat queue.txt` ## Will loop inside queue.txt and place each line as a value $i
do
wget $i ## wget will download the value $i
sleep 4
done

That’s it!

Setting up iptables - firewall

Posted by: Mo Mughrabi No Comments »

I had great hassle setting up the iptables on one of my online servers. but, thanks to Yousef when he was around on his last visit to Kuwait he showed me great tips and worked out a little script to bring up the firewall. The script is made to block all incoming ports accept apache, FTP, mysql foreign connections, shell and squid (proxy server).

# flush all current rules
iptables -F

# set default policies for INPUT, FORWARD, and OUTPUT chains
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT

# set access for localhost
iptables -A INPUT -i lo -j ACCEPT

# accept packets belonging to established connections
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

# accept connection on port 80 (HTTP)
iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT

# accept ssh and ftp connections
iptables -A INPUT -i eth0 -p tcp --dport 21 -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 8898 -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 3306 -j ACCEPT

# save our iptables rules
/etc/init.d/iptables save

VMWare Fusion + Ubuntu

Posted by: Mo Mughrabi No Comments »
VMWare Fusion plus Ubuntu

It was very easy install Ubuntu using VMWare the only annoying part was downloading Ubuntu (for taking long time). VMWare fusion makes it very easy to put any linux of windows version.. All I needed here the ISO file & specify certain space for the ubuntu. Installation took few minutes but the Ubuntu performance on the VMWare was horrible specially when it comes to the GUI. I would say this tool is good for testing purposes!

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Login