Baker College Student Web/Shell Server

crux.baker.edu - FAQs and information

Table of Contents

Crux Student Accounts and Access:

Crux student accounts are only created for those students currently enrolled in designated Baker College courses requiring access to a Unix server. If you are currently enrolled in such a course, yet are unable to access your Crux student account, please contact the Baker College Helpdesk by calling 1-800-645-8350 or by emailing helpdesk@baker.edu for assistance.

For security reasons, the only incoming TCP connections allowed on the crux server will be on ports: 22 (ssh), 80 (http), and 443 (https). This means that the only methods of accessing the crux server are: (1) from a web browser, or (2) from a SSH software client. Both methods are described below.

Back to top

Accessing Crux from a Web Browser:

Crux runs an Apache HTTP server to serve web content. The content can range from pictures and HTML files to complex web applications. The crux server utilizes per-user web directories.

This means that each student has their own "public_html" directory for placing web content. This web content is accessed by opening an internet browser such as Internet Explorer or Firefox and typing in the URL https://crux.baker.edu/~username/ where username is the same UserId the students utilizes to log in to Crux, Baker Blackboard and Baker Webmail.

Back to top

Accessing Crux from a SSH Client:

To run Unix commands from the Crux server command line, you will need to make a connection to the server from an SSH Client software that is installed on your local computer. You can dowlnload an SSH Client software from the Baker College Software Download Area. Please note that if your computer system is running Vista or Windows7, you must use the Putty SSH Client.

Once you have established a SSH connection to the Crux server, the prompt will be in your home directory. From this directory you will be able to execute unix commands. Please refer to the Baker College site for a list of common unix commands. If you ever get lost or need to return to your home directory, on the command line you can type cd ~ and press enter. The tilde (~) is UNIX shorthand for your home directory. To find out where your home directory is actually located, type echo ~ at the command line and press enter.

Back to top

Accessing MySQL on Crux:

A MySQL database has been created for each student that has a crux account. The name of the database is username_db where username is the same UserId the student utilizes to log in to crux, Baker Blackboard and Baker Webmail. The crux server is running a MySQL database server behind a firewall, which means that you cannot access the database directly from the internet. It can only be accessed through another program that is already running on Crux, such as Apache or Secure Shell.

Students are NOT permitted to create additional databases on the crux server, nor are they permitted to execute the mysql command "GRANT PRIVILEGES" on their database. Please refer to the Baker College Computer Resources area for detailed instructions on how to access MySQL on Crux.

Back to top

Email on Crux

The crux server will ONLY deliver email to Baker (@baker.edu) email addresses. All other mail will be rejected. The reason for this restriction is to prevent spam from originating on Crux which can result in the entire baker.edu domain being blacklisted.

Back to top

Uploading Files (Content) to my Crux directory

Students may be provided with files within their blackboard course that need to be uploaded to their crux student directory. Students may also be required to create their own files to be uploaded to their crux student directory.

Please Note - When creating files to upload to crux, you will want to use a text editor like Wordpad as opposed to Notepad or Microsoft Office so that the file you upload does not contain formatting characters such as ^M (Line Feed) at the end of each line. If for some reason a file is uploaded with these characters, you will need to run the /usr/bin/dos2unix command from the crux command line to convert the file from a DOS/MAC format to a Unix format.

To upload files to your crux student account, you will need to use a Secure File Transfer Protocol (SFTP) client. This will allow you to transfer files between your computer and your web directory on crux. You can download an SFTP client from Baker's software download page. For instructions on using this SFTP client, please refer to the Using SSH and SFTP page.

Place the files you want to make available on the web in the public_html directory located in your home directory. Only files within (or above) this directory are accessible from the web. For example, if your user name was "example", then you would place your files in the /home/example/public_html/ directory.

Back to top

The "Protected" directory

Within ~/public_html is a directory called protected. Only you and the faculty have access to this directory. Anyone attempting to access content within this directory will need to authenticate. In other words, when you point your browser at https://crux.baker.edu/~username/protected/, you will be prompted for a user name and password. Only those users with the appropriate access will be allowed to view the page.

Back to top

CGI Scripts

Crux allows you to run CGI scripts to create dynamic web content. Any file located in the ~/public_html/cgi-bin or ~/public_html/protected/cgi-bin will be treated as a CGI script. The script must also have the execute permission set. For example, from the command line, type:

cd ~/public_html                                  # go to your public_html dir
[ ! -d cgi-bin ] && mkdir cgi-bin                 # create a cgi-bin if it
                                                  # doesn't already exist
cd cgi-bin                         
cat<<EOD > test.pl                                # create a simple perl script
#!/usr/bin/perl
print "Content-type: text/html\n\nHello World!";
EOD
chmod +rx test.pl                                 # set the read and execute
                                                  # permissions for the script
To see the newly created CGI script in action, go to https://crux.baker.edu/~username/cgi-bin/test.pl where username is the user name you use to login to Crux.

Back to top

"Internal Server Error" Messages

An Internal Server Error message displays in the web browser when your CGI script fails to produce valid HTTP output. Some common causes are:

For more information about writing CGI scripts, see Apache Tutorial: Dynamic Content with CGI.

Back to top

Why does the GET method work, but the POST method does not?

Make sure that the action attribute of your form is pointing to https://crux.baker.edu/... and not http://crux.baker.edu/...

Crux's web server forces secure connections by redirecting HTTP requests to HTTPS. When that occurs, some browsers "forget" what method the form was suppose to be submitted in and send a GET request instead. To avoid this, set the form's action to https://crux.baker.edu/... so it won't be redirected.

You can see this problem in action by go to the form test page.

Back to top

How to debug PHP code on Crux

Why is display_erorrs disabled in the first place?

If you've tried to debug code on Crux, you may have noticed that the display_errors option has been disabled on Crux. This has been done primarily for two reasons. First, it approximates what you'd expect to find in a "hosted" environment where you're provided a server and URL to write web pages, but do not have direct access to the server. Second, turning on display_errors on a system that touches the Internet opens it up to several different forms of attack through the information that display_errors reveals. Furthermore, not only is it insecure, but it's impractical as well - not everyone wants errors displayed on their pages, and the majority do not. For these reasons, display_errors is typically turned off for hosted environments as well.

How do I debug my code then?

The quickest and most painless way to debug your code is to add the following lines to the beginning of your program:

error_reporting(E_ALL | E_STRICT);
ini_set("display_errors", 1);
This will display all errors except for syntax errors (such as a missing parenthesis or semicolon). To display those errors too, you will need to be a little more creative. Instead of just adding these lines to your script, you must include() your script to be tested from another known-good script. The easiest way to acheive this is to write a small debugger script as below, and fillin the script you want to debug in the include statement (replace "YOUR_SCRIPT" with the name of your script):
<?php
	error_reporting(E_ALL | E_STRICT);
	ini_set("display_errors", 1);
	include("YOUR_SCRIPT.php");
?>
From here, you should be able to access your checking script and see any errors that you may have in the script to be checked.

If using an additional script isn't feasible, or you'd rather work from the command line, you can also use PHP syntax checking by running php -l <YOUR_SCRIPT.php> right from the command line (replacing "YOUR_SCRIPT" with the name of your script. NOTE: This is a lower-case "L", not the number one.

Back to top