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.
- Sandbox
- Sandbox is server which we use to provide web pages to browsers.
- Sandbox runs Linux, a Unix clone.
- 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.
- Accounts and web service.
- For this class, you will use regular user accounts on Sandbox.
This is different from the web account used in the CSc 114 class.
- Each user has a password-protected account.
- Each account has a home directory for storing files.
- “Directory” is the same thing Windows calls a “folder.”
Just a collection of files.
- Individual home directories keep a user's files together and apart
from those of other users.
- Web directory.
- To publish a file on the web, place it in a sub-directory called
local_html. Files outside of local_html are not
published.
- A file called somefile.sometype stored in local_html by
a user someuser is available online by the URL
http://sandbox.mc.edu/homes/someuser/somefile.sometype, or by the more old-fashoned
http://sandbox.mc.edu/~someuser/somefile.sometype
- 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.
- You may also access your files via the secure protocol, https.
- Files outside the local_html directory are not accessible to
the web server.
- Transferring files from Windows with WinSCP.
(This is how you make your files
available on-line.)
- 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 simple web accounts used for CSc 114.
- You should use the SFTP or SCP protocols, and
WinSCP is an excellent
client client for them.
- When you open WinSCP the first time, you will see something like this:
- 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.
- 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.
- 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.
- WinSCP shows the listing of files in your server folder. You can
navigate it just like the local file system.
- 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.
- 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.
- An alternative to
WinSCP is
FileZilla, which also
has a Mac version.
- Both Linux and Mac clients come with the scp terminal command, which
allow quick transfers without needing a GUI client. You can
get the similar pscp program for Windows from the
putty web site, mentoned below.
- For this class, you only need to be able to copy files to the server.
You may edit and manipulate them on any platform you like. But your
Sandbox account gives you access to a Linux shell, if you want to use it.
Here is some information about that.
- Login
- From a Linux, Unix or Mac client, use the ssh program from the
command window.
- Say ssh userid@sandbox.mc.edu
- It will ask for your password, which will not be displayed as
you type.
- Get that right, and you're in.
- From Windows, use the free program
putty to connect to Sandbox.
- Double click it. Fill in the name of the computer to connect to,
sandbox.mc.edu.
- Set the protocol to ssh.
- Press Open.
- Sandbox will ask for your login name and password. Note that the
password does not display as you type it.
- It will then show you a command prompt for using the system.
- Change your password.
- To change your password, give the command passwd.
- It will ask for your existing password (to make sure you are you),
and your new password twice (to make sure you can type).
- The new password will be used for both file transfer and login.
- Working with files.
- You can use a text editor to create a file
- Most common one is called pico. Just say pico.
- It's like the Notepad program, but you must use the keyboard for
everything.
- 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.
- Listing files: ls for all of them, or ls filename.
- Viewing files a screen full at a time: less filename
- Copying files: cp oldname newname.
- Renameing files mv oldname newname. (The mv
stands for “move.”)
- Deleting files: rm filename.
(The rm stands for “remove.”)
- Finding out about commands: man commandname, or
man -k subject to do a search.
- Directories (folders).
- The command shell
always has a “current directory”. The files you view
or create are there.
- When you log in, you are in your home directory. The cd
command will change that.
- Say cd local_html to go to your web directory.
- 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>
- Point your browser at
http://sandbox.mc.edu/~yourid/test.html
- You can create directories with the command mkdir dirname.
- You can move up from a directory to its parent with cd ..