Pages

Wednesday, June 16, 2010

Simplest and Easiest Web Server

There are a lot of different ways to share data between Linux and Windows. We can use NFS, Samba, Ftp, Secureftp, http and so on. However, sometimes all of those methods are not suitable for some particular conditions. For example, I have a Fax Server running on Debian Linux. The server is not powerful enough to deploy a separate server role to handle file sharing. Its main purpose is to receive and send the fax message through modem. It even does not have firewall.
One day, a user need to get some data from the server. For me, as long as server is running ssh service, I can get what I want by using sftp or scp. For user, it may be totally different universe. If I try to teach my user how to use sftp and scp at that time, he will complain,"Please,Mr.IT, don't make my life difficult.......".
Here is how I slipped out of difficulty by using a module of Python programming language.I ssh to server and on console I type:
ip add | grep inet ; python -m SimpleHTTPServer
This command will show ip addresses of server. All I need to do is asking my user to open up the browser and type myserver's ipaddress:8000. Now he can download the data on server to his computer easily. I included the screenshot to show you how it looks like in browser.
From

SSH & Me!

Question: What is SSH?

Answer: Secure Shell or SSH is a network protocol that allows data to be exchanged using a secure channel between two networked devices

Here is how I utilize this ssh daemon in my daily life.

!)I have 3 intranet servers ( sshgateway, intrawebmail, and winterminal)
!)Firewall is configured so that I can only ssh to sshgateway from external i.e. My Home.

When I need to configure my linux server @ my office from anywhere,

#ssh root@sshgateway.mydomain.net

Ok internet connection is too slow...

#ssh -C –CompressionLevel=9 root@sshgateway.mydomain.net

Oh, I configured my server not to listen on port 22 (default sshd port) for security reason.

#ssh -p 443 root@sshgateway.mydomain.net

I must ssh to intrawebmail to fix some problems,but I can only access to sshgateway.

#ssh -t root@sshgateway.mydomain.net ssh root@intrawebmail

Now I get access to intrawebmail server.

Fixed! I need to check webmail from intrawebmail that is only accessible in office.

#ssh -L 8080:intrawebmail:80 root@sshgateway

1)In firefox, go to Tools>Option>Advanced>Network>Setting
2)In SOCKS host  127.0.0.1 port 8080
Now I can check my office webmail from outside.

How about my winterminal? Is it healthy?

#ssh -L 3389:interminal:3389

1)Now I can remote desktop to 127.0.0.1 that redirect to winterminal.

From public internet hot spot, I want to check my bank account. Network is not secure.
So, I will tunnel my traffic through my office network.(Some may call it "Bypassing Firewall")

#ssh -D 9999 root@sshgateway.mydomain.net

1)In firefox, go to Tools>Option>Advanced>Network>Setting
2)In SOCKS host  127.0.0.1 port 9999
Now my traffic is encrypted and  I can check my bank account securely

One of my friends asks me to help with setting up a linux server. Although I want to help, his server is in Myanmar and I can not ssh to it because it is extremely protected by ISP.

What I do is:
I ask him to ssh to my sshgateway from his highly protected server;

#ssh -R 9999:127.0.0.1:22 root@sshgateway.mydomain.net

Then, on my sshgateway server , I ssh back to his linux server by using:

#ssh -p 9999 root@localhost

Now I can ssh to a host behind NAT and Firewall.

LAST BUT NOT LEAST

Now you know how we can utilize SSH in various ways. But let me remind you that running a ssh host on internet is not as easy as you think.

Believe it or not: everyday I get 5 to 13 report emails from my ssh server that tell  
“ Some body is attacking ssh server by using bruteforcing............... and blah blah blah”

If you don't give enough attention to this log messages , somebody may be able to root your server one day. That compromised ssh daemon can even put you into jail.

Don't worry! I will show you how to secure ssh server, but not now. LATER.......

Hope it gives you some knowledge......
netlynker

Q: What is the best remote administration tool for Windows??
A: A car!

Monday, June 7, 2010

Teamviewer 4 Linux

In past, I used LogMeIn, Teamviewer and GoToMyPC to remotely control the Windows PCs.Since that time, I was always thinking why any of these company never came up with solutions for LINUX.
Some Linux Guru may say, "Why don't you use VNC?". I admit that VNC can do that job.However, if you have ever used VNC over WAN links such as ADSL, Cable Broadband and Dialup connection, you will see that it is impossibly slow to work with.
Finally, TEAMVIEWER brings the solution to LINUX's world. I installed the software on my lappy that runs Ubuntu Linux 10.04. Installation process goes well. After installing, I go to Applications>Internet> and run the Teamviewer software. Then, on another PC, I fire up browser and go to Teamviewer's Web Login Page. There I log in using ID, Password and Name.
If you have ever used TeamViewer before, it will be as easy as ABC.

Here are a few videos created by other. To save my time, I didn't create another video. These video will suffice your appetite.