MEWBIES@: Facebook Twitter G+ YouTube DeviantArt Forum Wall
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██ ██
█▌ - AJAXTERM: WEB BASED SSH TERMINAL - █▌
█▌ █▌
█ ▐▌
█ This one is a dream come true :) Imagine the possibilities with SSH ▐▌
█ access. Test some demos HERE to see if it will work for your needs. ▐▌
█ If the demo site is blocked on your firewall it could be because of the ▐▌
█ name 'anyterm' in its path (which is easy to fix on your own setup). ▐▌
█ ▐▌
█ I adore AjaxTerm. Super easy to install and a right bleepty-beep to get it ▐▌
█ to work in Apache2! Good luck getting 'proper' help :( ▐▌
█ I never did get it to *work how I 'thought/read' it should, so I did a ▐▌
█ little cheat; stuck in on another SSL port, 8443, that wasn't currently ▐▌
█ being used. Bug report page is HERE. ▐▌
█ *Note when I say work, I mean AjaxTerm working on port 443 without taking ▐▌
█ over that entire port/site. ▐▌
█ From my understanding you can still have a site/other pages on https (443) ▐▌
█ AND have a working AjaxTerm on the 'same port and same IP' . ▐▌
█ ▐▌
█ I've condensed my over 30 pages of notes to a working beautiful, easy, ▐▌
█ secure, AjaxTerm :) for you. (URL showing below in Opera is bogus.) ▐▌
█ ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ PREREQUISITES ▐▌
█ INSTALL AJAXTERM ▐▌
█ PASSWORD PROTECT AJAXTERM'S WEB PAGE ▐▌
█ CHANGE AJAXTERM PORT TO MATCH YOUR SSH PORT ▐▌
█ APACHE2 SETTINGS ▐▌
█ ▐▌
█ TROUBLE SHOOTING AJAXTERM ▐▌
█ AJAXTERM IN CONSOLE .PY ERRORS ▐▌
█ AJAXTERM CAN'T PASTE IN FIREFOX ▐▌
█ AJAXTERM DOESN'T HAVE A CONSOLE WINDOW, ONLY TOP TOOL BAR ▐▌
█ TIMEOUT ERRORS ▐▌
█ AJAXTERM FILES ▐▌
█ ▐▌
█ CUSTOMIZING AJAXTERM ▐▌
█ CHANGE AJAXTERM CONSOLE SIZE ▐▌
█ CHANGE AJAXTERM TITLE, FAVICON.ICO, ETC ▐▌
█ INCREASE SSH SESSION TIMEOUT ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ PREREQUISITES: ▐▌
█ `````````````` ▐▌
█ If you don't have a SSH browser installed, you need one to test AjaxTerm: ▐▌
█ su ▐▌
█ aptitude install lynx ▐▌
█ ▐▌
█ Of course Apache or another type of www serving software ▐▌
█ aptitude install apache2 ▐▌
█ ▐▌
█ For Apache2 make sure all the modules for proxy have been made available: ▐▌
█ a2enmod proxy_http ▐▌
█ a2enmod proxy ▐▌
█ Or you could do this: ▐▌
█ ln -s /etc/apache2/mods-available/proxy.conf /etc/apache2/mods-enabled/proxy.conf
█ ln -s /etc/apache2/mods-available/proxy.load /etc/apache2/mods-enabled/proxy.load
█ ln -s /etc/apache2/mods-available/proxy_http.load /etc/apache2/mods-enabled/proxy_http.load
█ ▐▌
█ You will need SSL: ▐▌
█ aptitude install openssl ▐▌
█ ▐▌
█ You will need to create a SSL certificate: ▐▌
█ apt-get install ssl-cert ▐▌
█ mkdir /etc/apache2/ssl ▐▌
█ /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem
█ You will be prompted to enter your site's domain. Be sure you delete out ▐▌
█ 'localhost' completely from their entry and type in your own site domain. ▐▌
█ Example: mewbies.com ▐▌
█ That's it, it will exit. By the way creating the cert in this manner it ▐▌
█ will be valid for 10 years. ▐▌
█ ▐▌
█ Enable SSL: ▐▌
█ a2enmod ssl ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ INSTALL AJAXTERM: ▐▌
█ ````````````````` ▐▌
█ su ▐▌
█ apt-get install ajaxterm ▐▌
█ /etc/init.d/ajaxterm start ▐▌
█ Reply will be: Starting web based terminal: ajaxterm ▐▌
█ exit ▐▌
█ ▐▌
█ Test it locally by entering: ▐▌
█ lynx http://localhost:8022 ▐▌
█ or lynx then: g http://localhost:8022 ▐▌
█ ▐▌
█ ▐▌
█ If all is working well your window will refresh and state AjaxTerm top ▐▌
█ right. This won't be a workable since SSH can't read java. Exit that now ▐▌
█ lets continue (exit press q then y). ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ PASSWORD PROTECT AJAXTERM'S WEB PAGE: ▐▌
█ ````````````````````````````````````` ▐▌
█ pico /etc/ssh/ssh_config ▐▌
█ uncomment (remove # before this line): PasswordAuthentication yes ▐▌
█ mkdir /srv/ajaxterm ▐▌
█ cd /srv/ajaxterm ▐▌
█ Make a new web login/password prompt to access AjaxTerm (remember don't ▐▌
█ use simple passwords) ▐▌
█ htpasswd -cm /srv/ajaxterm/.htpasswd MyName ▐▌
█ Replace MyName with the login name you want to use. ▐▌
█ You will be prompted to type password in twice, you won't see it and you ▐▌
█ can't paste it in. ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ CHANGE AJAXTERM PORT TO MATCH YOUR SSH PORT: ▐▌
█ ```````````````````````````````````````````` ▐▌
█ AjaxTerm by default will install on port 22 for SSH. If like me you have ▐▌
█ changed your SSH port you need to let AjaxTerm know: ▐▌
█ pico /etc/init.d/ajaxterm ▐▌
█ It has this: ▐▌
█ PORT=8022 ▐▌
█ SERVERPORT=22 ▐▌
█ Change 'SERVERPORT' to match your SSH port. For example: SERVERPORT=256 ▐▌
█ ▐▌
█ By the way your SSH port is here and if it is 22 it should be changed for ▐▌
█ security: pico /etc/ssh/sshd_config ▐▌
█ # What ports, IPs and protocols we listen for ▐▌
█ Port 22 ▐▌
█ ▐▌
█ Or yours might be here: pico /etc/xinetd.d/sshd ▐▌
█ Then restart your SSH: ▐▌
█ /etc/init.d/ssh restart ▐▌
█ Or: ▐▌
█ service sshd reload ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ APACHE2 SETTINGS: ▐▌
█ ````````````````` ▐▌
█ We are going to make a new vhost file, one that doesn't exist: ▐▌
█ pico /etc/apache2/sites-available/ajaxterm ▐▌
█ The code you copy/paste in below you must edit first to your needs: ▐▌
█ a. ServerName & Redirect entry 'my.site.org' to your own site's domain ▐▌
█ b. All port entries for 8443 to be on a free port you want ▐▌
█ c. The correct path to your apache.pem file, or instead of a .pem you ▐▌
█ might have: ▐▌
█ SSLCertificateFile /etc/ssl/certs/server.crt ▐▌
█ SSLCertificateKeyFile /etc/ssl/private/server.key ▐▌
█ d. 'require user myname' change myname to the name you entered above ▐▌
█ making your .htpasswd ▐▌
█ Code to copy/paste in: ▐▌
Listen 8443
<VirtualHost *:80>
ServerName my.site.org
Redirect 301 / https://ajaxterm.my.site.org:8443
CustomLog /var/log/apache2/access.log combined
ErrorLog /var/log/apache2/error.log
</VirtualHost>
<VirtualHost *:8443>
ServerName my.site.org
HostnameLookups Double
CustomLog /var/log/apache2/access.log combined env=!dontlog
SetEnvIf Request_URI "^/u" dontlog
ErrorLog /var/log/apache2/error.log
Loglevel warn
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/apache.pem
ProxyRequests Off
<Proxy *>
AuthUserFile /srv/ajaxterm/.htpasswd
AuthName EnterPassword
AuthType Basic
require user myname
Order Deny,allow
Allow from all
</Proxy>
ProxyPass / http://localhost:8022/
ProxyPassReverse / http://localhost:8022/
</VirtualHost>
█ ▐▌
█ Then enable it by: ▐▌
█ a2ensite ajaxterm ▐▌
█ ▐▌
█ Reload apache: ▐▌
█ /etc/init.d/apache2 reload ▐▌
█ ▐▌
█ Reload ajaxterm: ▐▌
█ /etc/init.d/ajaxterm stop ▐▌
█ /etc/init.d/ajaxterm start ▐▌
█ ▐▌
█ Done :) ▐▌
█ Now go to: https://yoursite.com:8443 ▐▌
█ Accept your self signed certificate. ▐▌
█ Login using your normal SSH login username and password. ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ TROUBLE SHOOTING AJAXTERM: ▐▌
█ `````````````````````````` ▐▌
█ AJAXTERM IN CONSOLE .PY ERRORS: ▐▌
█ If you receive errors following the cmd 'ajaxterm' in SSH, though it is ▐▌
█ running in browser and/or it starts in the shell, quit ajaxterm (Ctrl+z ▐▌
█ if trapped in ajaxterm cmd): ▐▌
█ Errors similar to: ▐▌
█ [snip] ▐▌
█ File "/usr/share/ajaxterm/ajaxterm.py", line 649, in main ▐▌
█ g_server = qweb.QWebWSGIServer(at,ip='localhost',port=int(o.port),threaded=▐▌
█ [snip] ▐▌
█ socket.error: [Errno 98] Address already in use ▐▌
█ ▐▌
█ Enter this: ▐▌
█ killall -15 python ▐▌
█ If that still hangs then do: ▐▌
█ killall -9 python ▐▌
█ Then re-start ajaxterm: /etc/init.d/ajaxterm start ▐▌
█ ▐▌
█ By the way inform your users to quit AjaxTerm properly in the browser, as ▐▌
█ it will keep using system resources. Don't just close the webpage, treat ▐▌
█ it just like an SSH session (as it is) and type in first: exit ▐▌
█ Then close the web page. ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ AJAXTERM CAN'T PASTE IN FIREFOX: ▐▌
█ Firefox: To be able to paste in a java window in Firefox you need to do ▐▌
█ some changes. ▐▌
█ A. *I don't recommend this 1st method until a better version comes out: ▐▌
█ I installed v0.6 'AllowClipboard Helper' addon for Firefox, HERE. ▐▌
█ *Once I installed this add-on it closed Firefox without asking and removed ▐▌
█ all tabbed sites I had opened (though I have those set to save). Paste ▐▌
█ still did not work and the add-on wouldn't fully un-install until I ▐▌
█ rebooted. grrrr ▐▌
█ ▐▌
█ B. In Firefox type in address bar: about:config ▐▌
█ set signed.applets.codebase_principal_support to true ; just double click ▐▌
█ on it. That use to work. Now it doesn't. Follow the rest of the steps ▐▌
█ HERE. It might work for you, it didn't for me as stated in Update below. ▐▌
█ ▐▌
█ UPDATE I've noticed that 'Paste' is not working again for me using ▐▌
█ ajaxterm v0.10-12 with portable Firefox v23, 24, and 25. Same with ▐▌
█ portable Opera 12.16 and IE 8.0.6001.18702. None of the fixes above ▐▌
█ worked for me in Firefox. ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ AJAXTERM DOESN'T HAVE A CONSOLE WINDOW, ONLY TOP TOOL BAR: ▐▌
█ AjaxTerm in Firefox 3.6.+ will only show the top tool bar without a ▐▌
█ console window - bug report here. ▐▌
█ To fix this first see what version ajaxterm you have: dpkg -l ajaxterm ▐▌
█ In version 0.10-12 the fix is already included. I'm now using Firefox 23+ ▐▌
█ and this same problem is back. I've yet to find a fix for it so either I ▐▌
█ put up with the ugly no console window or use a different browser :(. IF ▐▌
█ anyone finds a working fix Please Post It In Mewbies Forum, Thx! :) ▐▌
█ ajaxterm version 0.10-2+lenny1 patch: ▐▌
█ su ▐▌
█ Line 268: pico +268 /usr/share/ajaxterm/sarissa.js ▐▌
█ Has this: ▐▌
█ XMLDocument.prototype.readyState = 0; ▐▌
█ /** ▐▌
█ * <p>Emulate IE's parseError attribute</p> ▐▌
█ */ ▐▌
█ Change to this: ▐▌
█ try { ▐▌
█ XMLDocument.prototype.readyState = 0; ▐▌
█ } catch(e) { ▐▌
█ }; ▐▌
█ /** ▐▌
█ * <p>Emulate IE's parseError attribute</p> ▐▌
█ */ ▐▌
█ ▐▌
█ /etc/init.d/ajaxterm restart ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ TIMEOUT ERRORS: ▐▌
█ Furthermore with ajaxterm v0.10-12 I receive many timeout errors: ▐▌
█ Connection lost timeout ts:1384959863171 and sometimes followed by: ▐▌
█ Connection error status:400 ▐▌
█ Until I know why, stop and starting server usually fixes it, but not ▐▌
█ restarting it; I know it makes no sense /me shrugs: ▐▌
█ /etc/init.d/ajaxterm stop ▐▌
█ /etc/init.d/ajaxterm start ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ AJAXTERM FILES: ▐▌
█ By the way ajaxterm files are here: ▐▌
█ /etc/default/ajaxterm ▐▌
█ /etc/init.d/ajaxterm ▐▌
█ /usr/bin/ajaxterm ▐▌
█ /usr/share/ajaxterm/ajaxterm.css ▐▌
█ /usr/share/ajaxterm/ajaxterm.html ▐▌
█ /usr/share/ajaxterm/ajaxterm.js ▐▌
█ /usr/share/ajaxterm/ajaxterm.py ▐▌
█ /usr/share/ajaxterm/qweb.py ▐▌
█ /usr/share/ajaxterm/sarissa.js ▐▌
█ /usr/share/ajaxterm/sarissa_dhtml.js ▐▌
█ /usr/share/doc/ajaxterm/README.Debian ▐▌
█ /usr/share/doc/ajaxterm/README.txt.gz ▐▌
█ /usr/share/doc/ajaxterm/changelog.Debian.gz ▐▌
█ /usr/share/doc/ajaxterm/copyright ▐▌
█ /usr/share/lintian/overrides/ajaxterm ▐▌
█ /usr/share/man/man1/ajaxterm.1.gz ▐▌
█ /usr/share/python-support/ajaxterm.dirs ▐▌
█ ▐▌
█ Here are a few articles on setting up ajaxterm on Apache2: ▐▌
█ Debian-Maintainer README.Debian Ubuntu Wiki Wiki Bobcares ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ CUSTOMIZING AJAXTERM: ▐▌
█ ````````````````````` ▐▌
█ CHANGE AJAXTERM CONSOLE SIZE: ▐▌
█ According to the maintainer of AjaxTerm it is not possible to have a ▐▌
█ scroll bar on AjaxTerm's console window. If you want a longer scroll back ▐▌
█ then the best method is to increase the height of the console window. Keep ▐▌
█ in mind that with every key stroke the entire window is updated, so the ▐▌
█ larger the window, the slower the response can be. ▐▌
█ ▐▌
█ To resize AjaxTerm's terminal window you need to edit 2 files: ▐▌
█ su ▐▌
█ pico /usr/share/ajaxterm/ajaxterm.py ▐▌
█ Has this: ▐▌
█ def __init__(self,width=80,height=24): ▐▌
█ Change to the size you want, for example: ▐▌
█ def __init__(self,width=130,height=48): ▐▌
█ ▐▌
█ pico /usr/share/ajaxterm/ajaxterm.html ▐▌
█ Has this: ▐▌
█ t=ajaxterm.Terminal("term",80,25); ▐▌
█ Or v0.10-12 has this: ▐▌
█ t=ajaxterm.Terminal("term",width,height); ▐▌
█ Change to match the above settings: ▐▌
█ t=ajaxterm.Terminal("term",130,48); ▐▌
█ ▐▌
█ Note: When I made my window height larger than 99 it reverted back to its ▐▌
█ original size. ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ CHANGE AJAXTERM TITLE, FAVICON.ICO, ETC: ▐▌
█ I also made a few minor changes to its page: ▐▌
█ Change title, add your own favicon after the meta tag, etc, for example: ▐▌
█ pico /usr/share/ajaxterm/ajaxterm.html ▐▌
█ <link rel="icon" href="favicon.ico" type="image/x-icon" /> ▐▌
█ <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> ▐▌
█ Then upload your own favicon.ico to /usr/share/ajaxterm/ ▐▌
█ Btw you can make quick simple favicon.ico HERE on-line. ▐▌
█ ▐▌
█ To have the changes take effect you'll need to restart AjaxTerm: ▐▌
█ /etc/init.d/ajaxterm restart ▐▌
█ Upon which if you get this error when going to its web page: ▐▌
█ "Service Temporarily Unavailable ▐▌
█ The server is temporarily unable to service your request due to ▐▌
█ maintenance downtime or capacity problems. Please try again later." ▐▌
█ Stop and start it until it works: ▐▌
█ /etc/init.d/ajaxterm stop ▐▌
█ /etc/init.d/ajaxterm start ▐▌
█ exit ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ INCREASE SSH SESSION TIMEOUT: ▐▌
█ This is not for timeout errors as mentioned in trouble shooting. This is ▐▌
█ to increase idle time for SSH sessions before it drops the users. ▐▌
█ To change the timeout default of 2 minutes; 120 seconds it is here: ▐▌
█ pico /usr/share/ajaxterm/ajaxterm.py ▐▌
█ Change 120 (seconds) to the time you desire. ▐▌
█ INACTIVE_PROCESS_TIMEOUT=120 # I guess this is the IP max packet life...▐▌
█ ▐▌
█ ▐▌
█ //---------------------------------------------------------------------- ▐▌
█ ▐▌
█ If you find mistakes, have suggestions, and or questions please post at ▐▌
█ mewbies forum HERE - thank you. ▐▌
█ ▐▌
█ Last update on 22 Nov '13 ▐▌
█ ▐▌
█▌ █▌
█▌ - mewbies.com - █▌
█▌ █▌
██▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄██