Baker College Student Web/Shell Server

crux.baker.edu - FAQs and information

Table of Contents

Downloads and required tools

To access Crux, two basic tools are required - an SSH client, and an SFTP client. If you're using a Mac or Linux, you have a built-in SSH client that we support and recomment. If you use Windows, Baker supports and recommends the use of Putty (download) for SSH. On the Download page, download and run the Windows installer, and follow the prompts it gives you. For SFTP, Baker suggests and recommends FileZilla (download) for SFTP access on all platforms (Windows, Mac, and Linux). On the download page, be sure to choose the correct package for your system.

Crux Student Access Policy:

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 the Web server on Crux:

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 the SSH server on Crux:

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. Your course should have instructions on how to download an SSH client for your computer as well as how to use it. We recommend that you use PuTTY for Windows, or the built-in SSH availalbe on a Mac. You can find basic set up and login instructions here: Windows Mac OS X

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 list of basic UNIX commands below. 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, so to find out where your home directory is actually located, type echo ~ at the command line and press enter.

Common Unix Commands

cd		Changes the working directory
chmod		Changes the file mode and permissions
cp		Copies files
dos2unix	Converts text files from DOS format to Unix format
ls		Lists files in directories
mv		Moves and renames files
mkdir		Makes a new directory
pwd		Prints the working directory

Back to top

Accessing the MySQL server 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 user name the student utilizes to log in to crux, Baker Blackboard and Baker Webmail. Student's log in credentials for the MySQL database are different than the standard login; Your username is the same, but your password for MySQL will be the first initial of your first name, the first initial of your last name, and the last six digits of your UIN example: js000000. 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 own database.

The crux server is running a MySQL database server behind a firewall, which means that you cannot access the database directly from the internet. The only way that MySQL can be accessed on Crux through another program that is already running on Crux, in our case, Apache or SSH (Secure Shell). To access Crux via SSH, please see this section of the page. Once you're logged in via SSH, you can start up the MySQL command line with the following command mysql -u username -p username_db. This command will prompt you for MySQL password and connect you to your database. For more information, see the MySQL CLI man page.

If you wish to access MySQL on Crux with a desktop program such as MySQL Query Browser, follow the instructions linked above for setting up a tunnel. Once that is running (the SSH session must remain open for the tunnel to be active), put localhost:3306 for the host/server to connect to in your MySQL client.

Back to top

Accessing SFTP for uploading files (Content) Crux

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.

WARNING: when creating files to upload to crux, you will want to use a text editor like Wordpad as opposed to Notepad or Microsoft Office, and when you save the files, be sure to save them in a Unix Format. The reason is that if the file you upload is not formatted for Unix, it will be formatted for DOS and contain characters such as ^M (Line Feed) at the end of each line. Because CRUX is a Unix server, it will not understand these files and fail to execute them if they're scripts. 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. We recommend and support he use of FileZilla for Mac, Windows, and Linux users to access SFTP on Crux. For instructions on using this SFTP client, please refer see the document here: SFTP Client Instructions

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

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

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 begin with 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