An alternative to using scp to copy files between your machine and another machine on the network is to mount the other machines folder system so that the other machines folder seems like it is on your machine. This is often preferable to copying individual files, because there will only be one copy of the files you’re using, and you can then edit those files on your network drive using whatever plain text editor that you already have installed on your local machine. The following sections describe how to mount network directories and also how to unmount those directories based on your operating system. Note that it is good practice to explicitly unmount when you are done, just to make sure all file updates are written to the network disk, and that no file corruption will occur.
MacOS or Linux
First, you will need to open a terminal on your machine (not logged in to compute.cs.uwlax.edu). Second, you will need to create an empty directory/folder on your machine. This empty folder is referred to as the mount point; the location of the remote folder on your local folder. After you mount the network drive, the files will magically appear in this empty directory. Note that while those files seem to be on your hard drive, they are not. If you edit those files, for example, you are actually changing the files as they exist on the networked system. To create the mount point, use your terminal window to navigate to the place where you want to create this empty directory, and then issue the mkdir (make directory) command to create a new, empty, directory/folder. For example, if you wanted to call your mount point network, then you would issue the command:
You will only need to create this directory once, and then in the future, you can just reuse this empty directory as your mount point. Once you’ve created this mount point, then you can use the sshfs (ssh file system) command to connect to the server and mount the network directory. Continuing the example mount point named network from above, you will use:
sshfs firstname.lastname@example.org:./ ./network
Use your campus network username in place of username. Note that if your system does not have sshfs already installed, then you will need to first install (FUSE)[https://osxfuse.github.io].
The above sshfs command will mount your remote home directory to the local directory called network. You could alternatively mount one of the remote subdirectories if you would prefer. For example, if you have a cs370 subdirectory in your campus home directory, then you could issue:
sshfs email@example.com:./cs370/ ./network
That will make only the contents of cs370 visible in your mount point.
You can then descend into the network directory and see all of the remote files and subdirectories. Since those files appear to be on your computer, you are able to create, edit, and delete files in any folder or subfolder of the mount point.
When you are done working for the day, you will then want to unmount the network drive. This will flush any remaining synchronization of your files with the network disk. The command to unmount is actually called umount – notice there is no ’n’, that is not a typo. You must provide the name of your mount point to umount, in case you have several mounted directories at once. One other issue with umount is that you must have administrator privileges to unmount. Specifically, you must be the administrator of your machine. To execute a command with administrator privileges, you need to put the sudo command before the umount command. The term sudo stands for super-user do. So the full command would be (assuming that the mount point is called network):
sudo umount ./network
When you issue this command, it will prompt you for a password. It is the password of the user account on your machine, not your campus password.
Windows does not come with any sshfs support built-in so a third-party application is needed. A popular option for this is to use the free, open-source WinSCP. Download and install this program on your computer. When you install, you have the option to select between the Commander view and Explorer view. If you chose the Explorer view, then when running WinSCP, it will look similar to your usual file explorer, and you can also drag-and-drop files between your local machine and the network machine. And the best part is that you can simply edit files directly from the Explorer view. If you go that route, you can edit your project source code using whatever Windows plain text editor you want and when you save the source code, WinSCP will automatically copy the updated file to the server. We highly suggest this Explorer view.