Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1048927
  • 博文数量: 326
  • 博客积分: 10135
  • 博客等级: 上将
  • 技术积分: 2490
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-22 23:53
文章分类

全部博文(326)

文章存档

2014年(1)

2012年(4)

2011年(1)

2010年(4)

2009年(41)

2008年(44)

2007年(63)

2006年(168)

我的朋友

分类: LINUX

2008-05-05 11:58:20

If you need to administer a remote server but don't feel like installing a complete, complex application like , try , 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 development repositories.

Installation

The simple installation includes several short command-line steps, followed by a Web setup. After 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 AllowOverride All Options +FollowSymLinks +ExecCGI

Using Web Console

Click to enlarge 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 .

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 . 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.

Federico Kereki is an Uruguayan systems engineer with more than 20 years' experience developing systems, doing consulting work, and teaching at universities.
阅读(883) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~