Difference between revisions of "Graphical Shell with ajaxPHPterm"

From WebOS Internals
Jump to: navigation, search
(New page: This article will allow you to use your web browser on your Pre for a terminal using thttp-php and ajaxphpterm. You should have already rooted your Pre and installed an SSH server, and ena...)
 
(root -> accessing linux)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This article will allow you to use your web browser on your Pre for a terminal using thttp-php and ajaxphpterm. You should have already rooted your Pre and installed an SSH server, and enabled sudo.
+
This article will allow you to use your web browser on your Pre for a terminal using thttp-php and ajaxphpterm. You should have already accessed linux on your Pre and installed an SSH server, and enabled sudo.
  
 
1. SSH into your Pre.
 
1. SSH into your Pre.
 +
 
2. Install php-thttpd
 
2. Install php-thttpd
 
<pre><nowiki>
 
<pre><nowiki>
 
root@castle:/# /opt/bin/ipkg-opt install php-thttpd
 
root@castle:/# /opt/bin/ipkg-opt install php-thttpd
 
</nowiki></pre>
 
</nowiki></pre>
 +
 
3. Configure php-thttpd
 
3. Configure php-thttpd
 
<pre><nowiki>
 
<pre><nowiki>
Line 17: Line 19:
 
logfile=/opt/var/log/thttpd.log
 
logfile=/opt/var/log/thttpd.log
 
</nowiki></pre>
 
</nowiki></pre>
 +
 
4. Configure php-thttpd service
 
4. Configure php-thttpd service
 
<pre><nowiki>
 
<pre><nowiki>
Line 33: Line 36:
 
respawn
 
respawn
 
</nowiki></pre>
 
</nowiki></pre>
 +
 
5. Download and install ajaxPHPterm. Note thttpd requires php files to be mode 644 and executable files to be 755; change permissions where needed after the install.
 
5. Download and install ajaxPHPterm. Note thttpd requires php files to be mode 644 and executable files to be 755; change permissions where needed after the install.
 
<pre><nowiki>
 
<pre><nowiki>
Line 40: Line 44:
 
rm ajaxphpterm.zip
 
rm ajaxphpterm.zip
 
</nowiki></pre>
 
</nowiki></pre>
 +
 
6. Restart thttpd-php
 
6. Restart thttpd-php
 
<pre><nowiki>
 
<pre><nowiki>
Line 45: Line 50:
 
/sbin/initctl start optware-thttpd
 
/sbin/initctl start optware-thttpd
 
</nowiki></pre>
 
</nowiki></pre>
 +
 
7. Open up the pre's web browser and go to
 
7. Open up the pre's web browser and go to
 
<pre><nowiki>
 
<pre><nowiki>
Line 52: Line 58:
 
This needs verification, and probably more detail in some places (it's working on my device, but text is mostly from IRC conversation).
 
This needs verification, and probably more detail in some places (it's working on my device, but text is mostly from IRC conversation).
  
This is obviously not that secure at all. For one thing, if you change your firewall rules device is wide open. But it's the first way I've found to get access to a local shell that works enough to enter commands and get results ([[[shell| WebShell]]] doesn't work for me for some reason).
+
This is obviously not that secure at all. For one thing, if you change your firewall rules device is wide open. But it's the first way I've found to get access to a local shell that works enough to enter commands and get results ([[Graphical_Shell_with_WebShell]] doesn't work for me for some reason).
  
This procedure, or just rooting your pre and installing stuff, may cause some [[[rooted-pre-issues]]]; read that page to see if those would be acceptable trade-offs to you.
+
This procedure, or just rooting your pre and installing stuff, may cause some [[rooted-pre-issues]]; read that page to see if those would be acceptable trade-offs to you.
  
 
The display size can be made more sensible by adding the following in the head section of index.php:
 
The display size can be made more sensible by adding the following in the head section of index.php:
Line 63: Line 69:
 
Also note that the "cd" command does not work (I think because the shell commands are executed one at a time, eg in separate processes for each command line followed by a return), but you can access and run files in any path - just treat the command line like shell commands in a GNU Make file :-)
 
Also note that the "cd" command does not work (I think because the shell commands are executed one at a time, eg in separate processes for each command line followed by a return), but you can access and run files in any path - just treat the command line like shell commands in a GNU Make file :-)
  
Since the shell is so limited and does not support curses / ncurses or any other kind of full screen mode, it's best used just to execute scripts that have been previously created or modified with a [[[text-editor]]].
+
Since the shell is so limited and does not support curses / ncurses or any other kind of full screen mode, it's best used just to execute scripts that have been previously created or modified with a [[text-editor]].

Latest revision as of 16:20, 28 July 2009

This article will allow you to use your web browser on your Pre for a terminal using thttp-php and ajaxphpterm. You should have already accessed linux on your Pre and installed an SSH server, and enabled sudo.

1. SSH into your Pre.

2. Install php-thttpd

root@castle:/# /opt/bin/ipkg-opt install php-thttpd

3. Configure php-thttpd

root@castle:/# cat > /opt/etc/thttpd.conf 
dir=/
port=8080
user=root
chroot
nosymlink
novhost
logfile=/opt/var/log/thttpd.log

4. Configure php-thttpd service

root@castle:/# cat > /etc/event.d/optware-thttpd 
description "thttpd Daemon for WebOS"
author "Danny Clark"
version 1.0

# don't start until the WebOS finishes it's normal boot 
# that way no delay is added to the GUI startup
start on stopped finish
stop on runlevel [!2]

# run the daemon
exec /opt/sbin/thttpd -C /opt/etc/thttpd.conf -D
respawn

5. Download and install ajaxPHPterm. Note thttpd requires php files to be mode 644 and executable files to be 755; change permissions where needed after the install.

cd /opt/share/www
wget http://voxel.dl.sourceforge.net/sourceforge/ajaxphpterm/ajaxphpterm.zip
unzip ajaxphpterm.zip
rm ajaxphpterm.zip

6. Restart thttpd-php

/sbin/initctl stop optware-thttpd
/sbin/initctl start optware-thttpd

7. Open up the pre's web browser and go to

http://127.0.0.1:8080/opt/share/www/ajaxphpterm/index.php

This needs verification, and probably more detail in some places (it's working on my device, but text is mostly from IRC conversation).

This is obviously not that secure at all. For one thing, if you change your firewall rules device is wide open. But it's the first way I've found to get access to a local shell that works enough to enter commands and get results (Graphical_Shell_with_WebShell doesn't work for me for some reason).

This procedure, or just rooting your pre and installing stuff, may cause some rooted-pre-issues; read that page to see if those would be acceptable trade-offs to you.

The display size can be made more sensible by adding the following in the head section of index.php:

<meta name="viewport" content="width=device-width" />

Also note that the "cd" command does not work (I think because the shell commands are executed one at a time, eg in separate processes for each command line followed by a return), but you can access and run files in any path - just treat the command line like shell commands in a GNU Make file :-)

Since the shell is so limited and does not support curses / ncurses or any other kind of full screen mode, it's best used just to execute scripts that have been previously created or modified with a text-editor.