Using Our Server
We use a Linux server at sanbox.mc.edu to host web pages. Linux is a Unix clone. For this class, we need only be able to transfer files to the server so they will be available online. You also have access to the Unix shell, though its use is optional.
  1. Sandbox
    1. Sandbox is server which we use to provide web pages to browsers.
    2. Sandbox runs Linux, a Unix clone.
    3. It is only necessary only to be able to transfer files to the server, but knowing a bit about how to use it directly can be helpful.
  2. Accounts and web service.
    1. For this class, you will use regular user accounts on Sandbox. This is different from the web account used in the CSc 114 class.
    2. Each user has a password-protected account.
    3. Each account has a home directory for storing files.
      1. “Directory” is the same thing Windows calls a “folder.” Just a collection of files.
      2. Individual home directories keep a user's files together and apart from those of other users.
    4. Web directory.
      1. To publish a file on the web, place it in a sub-directory called local_html. Files outside of local_html are not published.
      2. A new account does not have a local_html; you must create it. This is needed only once.
      3. A file called somefile.sometype stored in local_html by a user someuser is available online by the URL http://sandbox.mc.edu/~someuser/somefile.sometype
      4. If you create a subdirectory (sub-folder) inside local_html, its contents are also visible online, and the directory name becomes a component of the URL. If user smith creates a folder proj under local_html, and places the file idea.html inside proj, the URL would be http://sandbox.mc.edu/~smith/proj/idea.html.
  3. Transferring files from Windows with WinSCP. (This is how you make your files available on-line.)
    1. A common way to place files on a server is using the FTP protocol. You shouldn't use FTP for this, however. On Sandbox, FTP only works with the simple web accounts.
    2. You should use the SFTP or SCP protocols, and WinSCP is an excellent client client for them.
    3. When you open WinSCP the first time, you will see something like this:
    4. Click New, and fill out the form with the name of the server (sandbox.mc.edu) and your account name. You may fill in your password here, else it will ask you when you push login.
    5. Push Login. The system will ask for your password if you didn't give it earlier. Then it will show you a listing of the files on your account.
    6. Right-click, choose New, and then Directory. You will get a dialog asking for the directory name. Type local_html and say ok. You will now see the new folder in your list.
    7. WinSCP shows the listing of files in your server folder. You can navigate it just like the local file system.
    8. You can transfer files to and from the server by dragging them in the usual way. The only difference is that WinSCP will raise a dialog asking if you want to copy the files. Just tell it yes.
    9. If you wish, on the second screen shown above, you can fill in your password and push Save. This will save this information on your computer, and you will be then able to select it from a list on the first screen, so you won't need to type everything again. You probably don't want to do this on a public computer.
  4. An alternative to WinSCP is FileZilla.
  5. MacOS comes with the command line scp program, which can copy files,
    1. Like this, using the Terminal.
    2. The scp program is not good at creating individual directories, but it can copy an entire file tree using the -r option.
    3. You can also Google for graphical SCP clients. There are several free ones.
  6. Linux also uses scp.
  7. Using the Unix command line. (This material is optional.)
    1. Login
      1. Use the free program putty to connect to Sandbox.
      2. Double click it. Fill in the name of the computer to connect to, sandbox.mc.edu.
      3. Set the protocol to ssh.
      4. Press Open.
      5. Sandbox will ask for your login name and password. Note that the password does not display as you type it.
      6. It will then show you a command prompt for using the system.
    2. Change your password.
      1. To change your password, give the command passwd.
      2. It will ask for your existing password (to make sure you are you), and your new password twice (to make sure you can type).
      3. The new password will be used for both file transfer and login.
    3. Working with files.
      1. You can use a text editor to create a file
        1. Most common one is called pico. Just say pico.
        2. It's like the Notepad program, but you must use the keyboard for everything.
        3. Pico shows you the command keys at the bottom of the screen. The notation ^X means to hold down the control key and press x.
      2. Listing files: ls for all of them, or ls filename.
      3. Printing files: lpr filename, or pr filename | lpr
        Works from labs on campus. Won't print to your printer at home.)
      4. Viewing files: more filename
      5. Copying files: cp oldname newname.
      6. Renameing files mv oldname newname. (The mv stands for “move.”)
      7. Deleting files: rm filename. (The rm stands for “remove.”)
      8. Finding out about commands: man commandname, or man -k subject to do a search.
    4. Directories.
      1. The command shell always has a “current directory”. The files you view or create are there.
      2. When you log in, you are in your home directory. The cd command will change that.
      3. Say cd local_html to go to your web directory.
      4. Use pico to create this file as test.html:
        <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Hello</title> </head> <body> Greetings, earthlings! </body> </html>
      5. Point your browser at http://sandbox.mc.edu/~yourid/test.html
      6. You can create directories with the command mkdir dirname.
      7. You can move up out of a directory with cd ..