Author: Federico Kereki
If you need to administer a remote server but don’t feel like installing a complete, complex application like Webmin, try Web Console, a modern, over-the-Web, AJAX-based solution that’s easy to configure and use.
The GPL-licensed Web Console lets remote users access a shell and execute any commands — subject to their rights, of course. You can also use the Web interface to upload or download files to or from the server, edit files there, and back up and restore files or databases. In other words, you can do any task you could do if you were sitting in front of the server itself. Other interesting features include a simple installation process (which doesn’t even require root permission), secure connection using HTTPS, and quick refreshes using AJAX technology, for a user experience that closely matches an actual console.
Web Console’s latest version is 0.2.5 beta, and it’s in full development. It’s written in Perl, and the distributed code is compressed, which helps it achieve greater performance and a faster startup time, but makes the code hard to read. If you wish, you can get readable source code from the Subversion development repositories.
Installation
The simple installation includes several short command-line steps, followed by a Web setup. After downloading the current version, create a directory for the application and unpack the archive:
# md webconsole # cd webconsole # unzip ../web-console_v0.2.5_beta.zip Archive: ../web-console_v0.2.5_beta.zip inflating: changelog.txt inflating: readme.txt inflating: wc.pl inflating: web-console_shell.hta
Web Console is just a single-file application: wc.pl. Working as root, create a directory on your Web server to hold the software; for openSUSE, use /srv/www/htdocs, and for other distros, use /var/www/html. Verify that the directory has 755 rights and move wc.pl to it. If your server is set up to run as a specific user, you might have to change the owner of the directory. If you’re using Apache, the contents of file /etc/apache2/uid.conf will show you the required user and group.
# su # md /srv/www/htdocs/webconsole # mv wc.pl /srv/www/htdocs/webconsole # chmod 755 /srv/www/htdocs/webconsole # chown -R wwwrun.www /srv/www/htdocs/webconsole
Next, ensure your Web server will execute your script with Common Gateway Interface (CGI) rather than mod_perl. Create an /etc/apache2/conf.d/webconsole.conf file with the following content, and then run /etc/init.d/apache2 reload
so Apache will use your updated configuration:
AddHandler cgi-script .cgi .pl <Directory /srv/www/htdocs/webconsole/> AllowOverride All Options +FollowSymLinks +ExecCGI </Directory>
Using Web Console
To access Web Console, navigate with a browser to http://yourServerURL/webconsole/wc.pl. The first time you visit this address, you’ll see a setup screen where you define the administrator’s name, password, and email. (Web Console maintains its own list of users.) Click on Install to finish the process. After that first-time installation, you’ll see a login screen that asks for your username and password; enter the data, and you’ll face a normal-looking console screen.
You can do almost anything with Web Console that you could do if you were sitting at the computer console itself. Play around with some commands and you’ll notice that the AJAX interface refreshes in the background. Try, for example, using the Tab key for command completion — you’ll see a quick Waiting message as the results of the command come to your screen. Some commands that require a separate data entry process (such as su
) won’t work, though you can manage a workaround by judiciously editing the sudoers file.
All your commands will be run as the standard Web server user. If this is a problem, you might have to use suexec
(if you’re using Apache) to run Web Console as a different user. On a related note, for security, consider adding access controls to wc.pl, and even using a secure connection.
The special #
command built into Web Console brings forward a menu of several useful commands. #file
, for instance, lets you transfer files. The #manager
command shows a simple but useful file manager, allowing you to examine files and directories. Use #settings
to change the configuration of Web Console, and #users
to manage who’s allowed to use it.
Web Console provides more benefits than a simple SSH connection and fewer complications than a full Webmin installation. You can make Web Console as secure as either of those two options, and its light requirements won’t cause any problems with your server. Web Console has some inconveniences (such as the sudo
restrictions and the need for suexec
), but you can solve these issues. For short command-line work, or for file management duties, Web Console is worth a try.
Categories:
- System Administration
- Internet & WWW