Skip to main content

Share applications with ssh (SaaS)

We are going to share our server's application programs to client system without actually installing it to client's pc. In this example we are going to use firefox as application program but any installed application(on server side) can be used for SaaS.

Server- RHEL7.2
Client- Windows or any linux based OS

For any type of service we need server applications which defines protocols that tells how the communication to client is going to happen.

For SaaS we will use SSH protocol-
Secure Shell (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network.
The server will be open-ssh --
OpenSSH is the connectivity tool for remote login with the SSH protocol. It encrypts all traffic to eliminate eavesdropping, connection hijacking.

Step 1-
Installing SSH server --
Open terminal and type-
[root@www Desktop]# yum  install openssh-server

This will install the open-ssh server to your rhel7.2 server. In case you don't have the rpm file for open-ssh server then you can download it from Internet.

But there is a problem in it as it can not transfer graphics to client yet. In linux X window is used for graphics purposes. So we need to enable it on server side to transfer graphics using ssh.
Step 2 -
We need to change the configuration file of ssh which is placed in
 /etc/ssh/sshd_config. We can directly open it in gedit or type in terminal-
[root@www Desktop]# vim  /etc/ssh/sshd_config
You will find --
#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
something this after scrolling through 80%

 Change X11Forwarding no to yes as -X11Forwarding yes

Step 3 -
After any change in any configuration file, we need to restart the service-
To restart ssh server- 
Type this command in terminal--
#systemctl restart sshd

To check the status-
#systemctl status sshd

To enable the service-
#systemctl enable sshd

We need to type the above commands and the
Server is now ready.  

SSH is a secure protocol, so it will need the client to log in first.
So create a user account for client--
#useradd clientname

 

For client(Windows/linux)--

Your server do not have a public ip, by which any client can reach your server through Internet.
So, we for now assume that the client and server is on a private network.
Just take another laptop/pc or  install a new O.S. on virtual machine of same computer.
The required condition is both should be connected.

To check conectivity--
Find IP address-
linux--
#ifconfig

windows--
in command prompt type--
#ipconfig  

By typing above command on both client and sever you can find the ip address of both written after their respective network cards.
Try following commands--
From client pc--
#ping (IP of server)
for example--
#ping 192.168.43.80

If it can ping then you are all set.

 Client(Linux)--
Let IP of server is --192.168.0.125
Type on client pc--

#ssh -X -l clientname 192.168.0.125 firefox

It will ask for password for client account
 Type the password and the magic would just happen 

(Here -X is use to enable X11 agent on client pc to recive the graphics.)

On client pc even if firefox is not installed, the firefox which is actually running on server pc and using server's resources, internet speed will come to client's pc as a interactive display which client can use.

Client can even login and use firefox from differnet pc each time by using his account name in above command, will still found the same history in all the browser he will use as the centralized storage is server's resources.

You can just replace firefox with any application, but that must be installed on server. 

This the magic of all these Technologies which we will call as SaaS. 

 Client(Windows)--

 To use SSH on your windows machine, You will need two softwares on client pc: A SSH client(Putty) and X11 display server(XMING).

On the client PC, download the two softwares: Putty and Xming from internet.

Putty will work like a SSH Client and Xming will work as a X11 display server for your client as these two servers do not come in most windows machines by default.

Once the server is all set up, you just need to do these simple steps:

- Open Xming.
- Open Putty and enter you server's IP



- Turn on X11 in putty and then click on Open



Now you will have a ssh terminal on you windows client pc:

- Enter the username and password.
- Enter the name of application (e.g. FireFox).

Now sit back and relax, the firefox running on your linux pc is now displayed on your Windows machine.

Yes, you can also type in "GNU-Terminal" instead of firefox and now you have a fully flexed Linux terminal on your windows machine.

You can also have a Android smartphone as your client.
Just download any ssh client and x11 display server from play store and you are good to go.

Comments

  1. can this be done in GUI? i want to access SSH server using website by embedding python script to it. is it possible to do that? and there will be list of apps in website so that client can access to it just by clicking specific app icon. so which langguage should i use to access ssh server using website. i am thinking of python.

    ReplyDelete
  2. Yes, can be done using your approach.
    place the icons on UI and give the path to your python script that will process accordingly and finally will provide the executable script file to download, that will have the desired code:
    You can use the following code for help:

    #!/usr/bin/python
    import os
    import cgi,commands
    print"content-type:text/html"
    print""

    x=cgi.FieldStorage()
    name=x.getvalue('anyname') //get the username
    sw=x.getvalue('softwarename') //get the application name

    f="ssh -X -l "+name+" 192.168.43.80 "+sw

    i1=commands.getstatusoutput("sudo touch {}{}.sh".format(name,sw))
    i=commands.getstatusoutput("sudo chmod 777 {}{}.sh".format(name,sw))
    j=commands.getstatusoutput("sudo echo \""+f+"\"> "+name+sw+".sh")
    k=commands.getstatusoutput("sudo tar -cvf {}{}.tar {}{}.sh".format(name,sw,name,sw))
    l=commands.getstatusoutput("sudo chmod 777 {}{}.tar".format(name,sw))
    m=commands.getstatusoutput("sudo mv {}{}.tar /var/www/html/tar".format(name,sw))
    print "GET"


    Thanks

    ReplyDelete
    Replies
    1. thank you so much for that. one question is, is it ok to use openstack for creating server and clients. will it be possible to run that python script to run CGI ?

      Delete
    2. Yes, depends on your project. Otherwise you can simple you a apache webserver. Thanks

      Delete
  3. Hello, nice tutorial. Can we use django to create simple GUI and access those commands? Does django supports shell script execution? I want to create simple basic GUI from which i can execute shell commands and then it should get output.

    ReplyDelete
    Replies
    1. Your tutorials helps us so much and it's also unique. Please upload more tutorials on cloud computing.

      Delete
  4. Thanks so much for appreciation. Will upload more such tutorials.
    Well I don't have much experience with django but i believe it uses WSGI instead of CGI. But it is still based on pure python with some additional libraries. It should work on that too.

    ReplyDelete
  5. Thank you for your valuable content , Easy to understand and follow. As said, the migration to cloud is very essential for the protection of the database.

    Cloud Migration services
    Aws Cloud Migration services
    Azure Cloud Migration services
    Vmware Cloud Migration services
    Database Migration services

    ReplyDelete
  6. Pridesys IT Ltd. helps you secure, deliver, manage and govern your cloud environment and speed up deployment with independent, objective IT research and advisory services that support your cloud initiatives end to end.to see more..
    Cloud Computing

    ReplyDelete

Post a Comment

Popular posts from this blog

Platform as a Service (PaaS)

Platform as a Service
========================================================

In simple words in this project we are going to develop a online coding webapp where you can just choose the programming language in which you want to code and Execute your code in the website itself.
The magic of using webserver and docker technology in PaaS is 
you can just connect all your device with the server and anyone connected with it will have access to the Coding Website we will develop.

1. First we will Develop the Web Page and Save it as  paas.html in the html folder of you apache server.

Write the Following code in that--


<form action ="http://192.168.43.80/cgi-bin/paas.py">
<br>

<pre>
    <h2>Select the Language</h2>   
<select name="languages">

  <option value="java">Java</option>
  <option value="python">Python</option>
  <option value="c">C</option>
  <option value="…

Software as a service(Saas)

Software as a service (SaaS)--
============================

You probably have seen Google docs or any web app, well in all web apps there is one common thing that they run on some remote servers and use their resources but still you can use them as they or we can say they will create the feeling that they are installed in our own system.

In cloud computing you can say that there are web apps are SaaS but as cloud computing is just a marketing term. All there web app providers were present even before cloud computing name came into market, now they are just changing name of their services by adding cloud to it or adding taglines like Into the cloud! but in real cloud computing the implementation of saas is bit different.

As we earlier said cloud computing is also on-demand computing... Suppose there is some CRM software which is very high cost and you need such a software for your company. But you don't want to pay for the times when you are not using the software or you may just need …