teaching machines

Accessing the W Drive on Linux

February 21, 2013 by . Filed under code, public.

The university kindly provides central storage to students, faculty, and staff. We can access this storage on Windows, Mac, Linux, and through a browser. On Linux, however, we end up running into some annoyances when we work with files on the W drive. (Our H drive is easy to access; it becomes our home directory, which we land in when we start an ssh session.)

One of those annoyances is wacky permissions for files students drop in their submission folders. Permissions look great on Windows, but when we try accessing them through Linux, neither faculty nor student can read the submitted files. Resolving this issue is under investigation with LTS.

A second annoyance is that the computer science directory on the W drive on the computer science servers contains a space. (Except on dplsubmit.) Spend any time at the command line, and you will learn to never embed spaces in file names. Spaces are normally used to separate tokens at the command line. To remove that special meaning of a space, one must escape it with a backslash (c\ s) or quote it (“c s”). This annoyance can easily be worked around by creating a shortcut to the c\ s directory in your home directory:

ln -s /network_shares/w_drive/c\ s ~/w
ln -s /network_shares/w_drive/c\ s/CJohnson/cs330 ~/w330

Now, every time you need to access something on W, go through this shortcut (symbolic link) instead of through /network_shares:

cd ~/w330
~/w330/regexercise/test_regexercise

These symlinks will not work under Windows, but they may save your life on Linux.

You could also define a variable that stored the path. However, a variable won’t necessarily fix the embedded space problem, especially if you use bash, which turns $w into two tokens if the variable contains a space. Variables also don’t persist between sessions unless you define them in your shell’s startup files. Symlinks do persist, just as your other files persist.