Shell in a box

From Linuxintro

Shell in a Box allows you to control a computer over the network using a Linux console in a web page.

Install it

Get it

  • Download shell in a box from google
wget http://shellinabox.googlecode.com/files/shellinabox-2.14.tar.gz
tar xvzf shellinabox-2.14.tar.gz
cd shellinabox-2.14
./configure && make && make install
  • make sure the firewall is open, here is an example for SUSE Linux:
rcSuSEfirewall2 stop
  • you are not allowed to log in as root, so make sure you have at least one ordinary user. Add a user name user like this:
useradd -m user
passwd user
  • call shell in a box
cd /tmp
shellinaboxd &

Make it persistent

You want the shell in a box daemon shellinaboxd to be started when booting your machine, so

for SUSE Linux

  • add the following line to /etc/init.d/boot.local:
shellinaboxd &
  • configure the firewall to always open up port 80 or stop it persistantly:
chkconfig SuSEfirewall2_setup off
chkconfig SuSEfirewall2_init off
  • configure apache to start on boot
chkconfig apache2 on

for Ubuntu

To start the shellinabox daemon after reboot add the following line to /etc/crontab:

@reboot root /usr/local/bin/shellinaboxd &

This will start the daemon only on reboot as a background job.

Hi there, just became aware of your blog thugorh Google, and found that itis really informative. I am gonna watch out for brussels.I'll appreciate if you continue this in future. Many people will be benefited from your writing. Cheers!

TroubleShooting

cannot read valid certificate

Symptom: ShellInABoxD does not start, it tells the error message:

Cannot read valid certificate from "certificate.pem". Check file permissions and file format.

Reason: See http://code.google.com/p/shellinabox/issues/detail?id=59. ShellInABoxD tries to create a file certificate.pem in the folder where it is started as user nobody:

/tmp # ll certificate.pem 
-rw------- 1 nobody nogroup 2794 Aug  5 07:53 certificate.pem

Solution: Start shellinaboxd in a directory that every user can access, e.g. /tmp:

cd /tmp
shellinaboxd &

forkpty() failed

Symptom
When you surf to the shellinabox page you see an error message
forkpty() failed
Solution
Kill all shellinaboxd processes and start them with root privileges:
killall shellinaboxd
shellinaboxd --user=0 & disown

minus sign

Symptom
The minus sign does not work if you type it on the keypad.
Solution
I could fix this by using Safari instead of FireFox

See also