Monday, 31 January 2011

Controlling Your Linux System with a Smartphone

Using simple Web technologies, you can turn your smartphone into a multipurpose device to control your computers.

Phone technology has come a long way recently. The gap between personal computers and handheld devices is becoming smaller. I keep hearing the phrase “death of the PC”, and there may be some truth to this statement. However, I believe many of us will continue to need access to larger and more powerful computers that are too big to fit in our pockets. To me, the best of both worlds is to have full control over a larger computer from my phone.

Many new smartphones have advanced Web browsers built in. With this technology, you can access an interface configured to run any command on almost any computer. It is fairly trivial to run a Web server on a Linux box. If you take the appropriate security measures, you quickly can build a Web interface designed specifically for handheld devices.

Security

The approach shown in this article is to use a user account to run commands on the system. Of course, there are security concerns in doing this, but with the appropriate precautions, it can be made reasonably secure.

The system will rely on Wi-Fi. This makes sense when dealing with handheld devices, so configure your Wi-Fi router with a password. Users that want to connect to the local intranet will have to enter a password into their device before seeing anything. Most devices will remember the credentials and connect automatically once in range.

To minimize the risks in the event of a security breach, let's also create the user account with minimal permissions. This is a good safety measure, even though the interfaces will expose only “safe” commands.

Setup

Install the following from your distribution's repository if not already installed: Apache2, apache2-suexec and libapache2-mod-perl2.

The first package is the Web server. If it doesn't start automatically after the install, run the command:

/etc/init.d/apache2 start

The second package allows you to run the Web server with the credentials of a particular system user. When it is installed, you need to issue the following command as root to enable the apache module:

a2enmod suexec

Some of the examples presented here require Perl CGI interoperability. The last package is needed for that.

Now, you need to configure Apache to run as your little-trusted user. On our family Linux box, I created an account for all the kids. The user name is “saturn”. This account can do things like play music and watch videos. However, it doesn't belong to any groups that can delete or change things of importance. So let's use this account as an example.

Edit your apache config, and add the following line to the default VirtualHost (*:80) or to the VirtualHost you want to use:

SuexecUserGroup saturn saturn

Apache runs as root, so it has the ability to run scripts as any user. The line above tells Apache to run as the user saturn and group saturn.

Now, restart Apache, also as root, with this command:

/etc/init.d/apache2 restart

The Web service now is running as the user saturn.

The Simplest Example

Playing a sound file from the command line is fairly trivial, and it's a good way to exhibit the simplicity of this setup—one button for one action.

I'm using a traditional Web stack: HTML, CSS, JavaScript and CGI. The CGI part can be accomplished with a number of different languages. This first example uses a shell script, for the sake of simplicity.

Create an index.html file in the root Web directory. For many systems, this is located in /var/www/. Some systems use /var/www/html/. In this file, add a button that calls a JavaScript function called playQuack():




The JavaScript for the playQuack() function is in bonkers.js. The entire index.html file looks like this:




Bonkers
content="initial-scale=1.0; user-scalable=no"/>









Some additional content worth mentioning is in the metatag. This tells smartphones not to scale the content of the page. Without this, the button would be very tiny on the screen.

Here is my default.css file. It defines a background color and specifies how the button will look:

html, body {

background-color: #1E1E26;
}

button#quack-button {
position: absolute;
top: 20%;
width: 70%;
left: 15%;
padding: 5px;
border-width: 3px;
color: #BFBFBF;
font-size: 34px;
font-weight: 800;
border-color: #9C9C9C;
background-image: -webkit-gradient(linear, left top
left bottom, from(#BF5A34), to(#463630));
-webkit-border-radius: 10px;
}

Many mobile browsers are starting to support WebKit CSS. This is exciting, because a couple lines of WebKit code can do some really fancy things. The last two lines before the last curly bracket tell the button to have rounded corners and a color gradient background.

Now you have a nice-looking button. Point the browser on your phone to the IP address of the Linux computer. You should see something similar to Figure 1.

Figure 1. A Simple Button Displayed on an iPhone

Next, let's make the button actually do something. Create the bonkers.js file in the root Web directory, and enter the following:

var myDomain = document.domain;

var cgiURL = "http://" + myDomain + "/cgi-bin/bonkers.cgi";
var xmlRequest;

function playQuack() {
xmlRequest = new XMLHttpRequest();
xmlRequest.open("GET", cgiURL, true);
xmlRequest.send(null);
}

This is the JavaScript that forms the client-side process. It creates a URL that essentially runs the CGI script on your Linux box. In this example, you really don't care about the return value from the CGI script.

Believe it or not, the hard part is all done. CGI scripts are extremely simple and easy to understand—especially for someone who is used to the command line.

All CGI scripts must be located in the cgi-bin directory. This commonly is located in /var/www/cgi-bin or /usr/lib/cgi-bin and is also configurable within Apache.

Here is the CGI script, bonkers.cgi:

#!/bin/bash


mplayer ~/quack.wav &

That's all. This is a Bash shell script. A reference to the shell path is at the top. Below that is a command to run MPlayer, which plays an annoying quack sound. You essentially can place any shell command here.

There you have it. Anybody with a smartphone and the Wi-Fi password can make quack sounds come out of the computer. Now it's time to do something a little more useful.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Create .Xauthority file

Parimal Naigaonkar's picture

Hi,
I really liked your article, I was trying it but there is no .Xauthority file in my home folder.
Can you guide me how to create it under ubuntu 10.10.
Thank You

Advantages of Linux Smart Phones

By Oolong

Advantages of Linux Smart Phones

Linux intelligent phones have been user-friendly with modernized facilities of Linux handling system. Though there have been many handling systems accessible for Smartphones identical to Symbian, Windows Mobile, Palm etc, Linux handling systems have been portion a users for many years. You might be meddlesome to buy a Linux Smartphone as we have been used to Linux building-block functionality. Another reason is which we might wish to knowledge latest things as good as singular facilities accessible in this OS. Though Linux Smartphones have been still in a expansion phase, due a open source inlet we have a leisure to write programs by yourself if we have been informed with programming. Linux Smartphones have been not specifically catering to infrequent as good as commercial operation users, though in a entrance years it will have a own poignant marketplace share.

Most of a engaging functions accessible in Linux intelligent phone have been due to a actuality which it is operated by Linux handling system. Most of a Smartphone functions identical to Web browsing, Office await as good as editing, Media playback as good as present messaging have been available. Linux Smartphone permits we to download as good as accumulate assorted packages which we can fit in your phone. You can remotely carry out a Personal Computer by requesting VNC as good as can additionally have giveaway phone calls by regulating soothing phone formed upon SIP. If we wish to speak to somebody during movement, we can operate 802.11b/g. You can write to yourself or operate sourceforge as good as find if it’s already created by someone. All these have been special advantages for Linux Smartphone users.

With all a functions identical to alternative intelligent phones, these phones have been still in a little ways a Pipe dream. Their life is really minimal as good as when compared with alternative Smartphones, there have been not many American providers charity Smartphones now handling upon Linux. But a removing softened as a subsequent chronicle of Palm handling complement is starting to be formed upon Linux. Other than ancillary open source projects upon Linux, it additionally concordant with determined Palm Operating complement applications as good as which is a bonus to work upon both platforms. There is starting to be launch of Motorola Smartphones formed upon Linux height in a future, as there is already a single handheld device with acceptance from FCC.

There was good success in Smartphones using with Linux handling complement upon hardware written for alternative brands of Smartphones. Palm Smartphone Treo runs utterly easily with Linux as good as so for alternative hardware additionally it won’t be which harder. Anything can occur in a destiny identical to which we might buy intelligent phones but any handling complement as good as we can implement a elite handling complement upon a Smartphone. One of a barrier Linux faces is a intercompatibility with a alternative Smartphones in a market Linux Phone Standards forum (LIPS) plays a categorical purpose whilst a sender uses WiFi to hit you. Access before well known as Palm source who have been a makers of Palm handling complement have been stipulate members in LIPS as good as a subsequent chronicle will be Linux based. This does not indicate which Linux Smartphones have been not severely supported. The many successful Smartphones in a marketplace identical to Motorola, Samsung, Panasonic as good as NEC have been using upon Linux. The Latest Smartphone SCH-i819 of Samsung focused for Chinese businessmen offers special chronicle of Linux for preferred submit of Chinese characters as good as hold shade support. The one more underline BREW helps for many of a Smartphone downloads.

Visit http://www.smartphonemall.info for a most appropriate deals upon intelligent phones as good as downloading utilitarian intelligent phone applications as good as tools.

Incoming search terms:

  • linux smartphones
  • alternative smartphone linux
  • smartphones on linux

ABI Research: Linux Smartphones Will Outperform All Others

By Cl Oinsight

With the number of Android-based smartphones constantly ticking upward, both consumers and manufacturers have enjoyed the fast-growing popularity of Linux-based, open-source devices. In a June 1 report, ABI Research is forecasting such growth to continue - though not based on Google's Android alone.

Linux-based smartphones, such as those running Google's Android, will outstrip the growth of the rest of the market and account for more than a third of worldwide market share by 2015, ABI is predicting. Android won't, however, be without competition.

Citing Google's figure of 60,000 Android smartphones currently shipping each day (though in a May 13 shareholders' meeting, Google CEO Eric Schmidt raised that figure to 65,000) ABI said it expects Linux-enabled smartphones to outstrip the growth of the rest of the worldwide smartphone market and comprise 33 percent market share by 2015.

By: Michelle Maisto

Linux-based smartphones, such as those running Google's Android mobile operating system, will outstrip other types in growth and account for more than a third of the worldwide market by 2015, ABI Research is predicting. Android won't, however, be without competition.

Rate This Article:

As the number of Android-based smartphones continues to grow, both consumers and manufacturers have enjoyed the increasing popularity of open-source-based mobile devices. In a June 1 report, ABI Research predicted that such growth will continue—and not based on the success of Google's Android operating system alone.

Citing Google's figure of 60,000 Android smartphones currently shipping each day (though at a May 13 shareholders' meeting, Google CEO Eric Schmidt raised the number to 65,000), ABI said it expects Linux-enabled smartphones to outstrip the growth of the rest of the worldwide smartphone market and win a 33 percent share of the market by 2015.

"Due to its low cost and ability to be easily modified, Linux in the mobile market today is nearly as disruptive as Linux was in the server markets a decade ago," ABI analyst Victoria Fodale said in a statement.

Fodale noted that much of operators' interest in Android has come thanks to its flexibility. Motorola, for example, has built its Motoblur functionality on top of Android, and HTC similarly built its Sense interface on Android.

"The Android platform can be modified so that OEMs can differentiate their products," Fodale continued, "and the licensing terms allow OEMs to innovate while still protecting proprietary work."

While Google is surely the frontrunner, Fodale noted, "Android is not without competition."

At the Mobile World Congress in February, for example, Samsung introduced the Linux-based Bada operating system, with Samsung Electronics Executive Vice President Ho Soo Lee saying Bada offered "a powerful opportunity for developers to get their applications onto an unprecedented number of Samsung devices across the world."

ABI described Bada as being "kernel-configurable," meaning that it can run on the Linux kernel or on a real-time operating system kernel, which means it can run on a variety of other devices as well as on smartphones.

The same week as the Bada debut, Nokia and Intel introduced the Linux-based MeeGo platform, which offers an application development environment called Qt.

"Applications and other content are not in a walled garden; rather the ecosystem is more like an open frontier," Kai Oistämö, Nokia executive vice president of devices, said in the announcement.

In a June 2 report, however, analysis company Ovum questioned how viable a competitor MeeGo will actually be, unless Nokia and Intel start selling far more smartphones.

"From the perspective of most third-party developers, MeeGo remains an unknown and unproven quantity that is entering an already highly competitive and crowded landscape," wrote Ovum analyst and report author Tony Cripps, adding that in the short term Nokia and Intel should focus not on smartphones but on other devices. They could then "capitalize on any successes to 'cross-sell' the benefits of Qt development onto Nokia's Qt-enabled feature [phones] and smartphones."

Cripps added, "Doing so may not prove easy, and will require considerable investment. We have yet to see whether MeeGo and its backers have the stomach for the fight, but it would be wrong to write off its changes until we see the merchandise."

For now, it's still Android that will be pushing Linux-based mobile phone growth forward. In a May 19 report, Gartner announced that Google's OS put in a phenomenal showing in the first quarter of 2010, with a 707 percent year-over-year increase in North America.

Sunday, 30 January 2011

How do I Download on a MEPIS Linux PC?

updated:

How do I Download on a MEPIS Linux PC?thumbnail


Files and programs can be downloaded several ways in MEPIS Linux.

MEPIS, first released in 2003, is a popular Linux distribution for both novices and savvy computer users. The graphical interface uses KDE, with functions similar to Microsoft Windows. Built on a Debian base, MEPIS has access to thousands of programs from the Debian repositories and downloading programs is an intuitive process. Files, music and photos can be downloaded via any web browser by a simple mouse command within the web browser.

Difficulty:
Moderately Easy

Instructions

things you'll need:

  • Root access
  1. Downloading Files With Your Browser

    • 1

      Go to the link of the file you wish to download.

    • 2

      Right-click on the link and select "Save As" to download the file.

    • 3

      Select the directory to which you wish to download.

    • 4

      Wait while the file downloads. Most web browsers will show a download manager to show your progress.

    Download With apt-get

    • 5

      Open a command shell.

    • 6

      Type "su -" to go to a root terminal, then press "Enter."

    • 7

      Type in your root password and press "Enter."

    • 8

      Type "apt-get install program", substituting the name of the package you wish to download. Press "Enter."

    • 9

      Follow the prompts; when asked to confirm your download and installation, type "Y" for yes, then press "Enter."

    • 10

      Wait while the package downloads and installs. The apt-get program will search for all files the program needs to run.

    • 11

      Type "Exit" to leave the root shell and press "Enter." This will leave you in a user shell.

    • 12

      Type the executable name of the program in the command shell and press "Enter." Watch for any error messages in the shell while the program launches.

    Using Synaptic

    • 13

      Open Synaptic by selecting "System/Synaptic Package Manager" from the K menu. You will be asked to type in your root password; do so.

    • 14

      Select the programs you wish to download and install.

    • 15

      Click "Apply" and wait for the package to install itself.

Tips & Warnings

  • Launch a program for the first time via a command shell; this way you can see any error messages.

  • Be careful what you download. While Linux is relatively impervious to viruses and malware, you still do not want to take chances.

  • Work carefully in the root shell; you can access any file or program from there and can damage your system.

References

Photo Credit

Read Next Article




What Is the Diffence Between Asus EEEPC 1000H & 1000HA Models?

Built-in Bluetooth is a useful netbook feature.
Built-in Bluetooth is a useful netbook feature.
Fotolia.com">netbook image by mattmatt73 from Fotolia.com

Asus bumped up the size of its Eee PC netbooks in 2008 with the launch of models such as the 1000H and 1000HA. The two netbooks feature larger, 10-inch screens and share many other specifications, but differ in several key areas.

    Hard Drive

  1. The 1000H, with an initial list price of about $50 more than the 1000HA, is equipped with an 80-gigabyte hard drive. That's 80 GB less storage than offered on the 1000HA.
  2. Bluetooth

  3. Owners of the 1000H enjoy built-in Bluetooth capability, enabling use of devices such as a Bluetooth mouse. The 1000HA lacks Bluetooth support, although it can be added via a Bluetooth USB adapter.
  4. Wireless

  5. The 1000H provides support for wireless 802.11n as well as 802.11b/g. The 1000HA is limited to the slower wireless b/g, an especially important distinction for travelers who need the fastest-possible Internet connection on the road.
  6. Shared Specifications

  7. Both netbooks are equipped with 1.6 GHz Intel Atom processors, 1 GB of DDR2 memory or RAM, and a 1.3-megapixel webcam.

Comparing the specs between an Asus EeePC 1000H and an Asus EeePC 1000AH.

Asus EeePC 1000H:

* Intel Atom N270 dual core CPU,
* Intel Mobile 945GME chipset,
* 1 Gb DDR2 667MHz RAM upgradable to 2Gb,
* 160 Gb SATA harddisk,
* Six-cell LiOn battery 6580 mAh,
* 10″ WVGA display at 1024×600,
* ElanTech touchpad,
* RaLing RT2860 wireless network adapter – IEEE 802.11bgn,
* Attansic Technology L1 Gigabit network adapter,
* Broadcom BT-253 internal USB bluetooth adapter,
* Alcor Micro SD/MMC Card Reader,
* Genesys Logic USB 2.0 webcam 1.3Mpixel.


Asus EeePC 1000HA:

  • Intel Atom 1.6GHz processor
  • 160GB 5400 RPM Hard Drive (Seagate 5400.4)
  • 1GB of DDR2 RAM (667MHz)
  • Windows XP operating system
  • 10” WSVGA LED-Backlit 1024 x 600 LCD
  • Ports: 3 USB 2.0, 1 VGA monitor out, headphone jack, microphone input, SD card reader (SDHC compatible), Kensington Lock slot, Ethernet 10/100
  • Webcam (1.3 MP)
  • Battery: 7.4v 6600mAh 6-cell battery
  • Wireless: 802.11b/g
  • Size: 10.47 (W) x 7.53 (D) x 1.12 ~ 1.50 (H)
  • Weight: 3lbs 2.5oz, 3lbs 11oz with AC adapter