Skip to content

How to connect to a UZH NAS from the ScienceCluster

Introduction

This guide describes how to access a UZH based NAS device. "NAS" stands for "network attached storage", and a NAS device is essentially a virtual hard-drive that can be mounted or connected to by any computer with the proper credentials and software.

In many cases, NAS devices are mounted to a computer's file system so that they interact the same way as external hard-drives connected to personal computers.

On the Cluster, a user can connect to a UZH based NAS using the smbclient tool. You can use this tool to connect to your specified UZH NAS device then explore the file system and download or upload files from/to the ScienceCluster file system.

Note

Please note that the smbclient does not mount the NAS to the ScienceCluster as part of the file system. Rather, it is used to directly connect to the NAS from the ScienceCluster so that you can access then download/upload any files needed for your cluster workflow. See the section below on relevant commands to use with this tool.

Connecting to a UZH NAS with smbclient

To connect to a UZH NAS, input the following command

smbclient --max-protocol SMB3 -W UZH -U username //nasaddress
and replace username with your UZH shortname and nasaddress with the address to your NAS. If you input the command correctly, and the NAS is working properly, you will then be prompted to enter your UZH password.

Adjusting the NAS address for the smbclient command

NAS addresses are often shared using their full prefix. For example, smb://examplenas.uzh.ch/username$. In this case, you would augment the command as follows:

smbclient --max-protocol SMB3 -W UZH -U username //examplenas.uzh.ch/username$
Note that the smb: prefix has been removed, but the username of the subfolder on the NAS remains.

In other cases, NAS addresses are given to users with a username used within the address prefix. For example, smb://username:*examplenas.uzh.ch/subfolder$. For this address, you would input the following into the smbclient command:

smbclient --max-protocol SMB3 -W UZH -U username //examplenas.uzh.ch/subfolder$

Operations

Once you've connected to your UZH NAS successfully, you will see the following appear in your terminal.

smb: \>

From this command prompt you can enter a variety of operations to interact with the files in your ScienceCluster area. Many of these operations are identical to their Bash counterparts. Important commands to note include:

  • ls
    • lists files and directories (including hidden files) in the present working directory;
  • cd
    • changes the command prompt location to another specified directory within the NAS device;
  • get
    • downloads a specified file from the NAS device and places it where you specify in the ScienceCluster file system;
  • put
    • uploads a specified file from ScienceCluster to the specified location on the NAS device;
  • exit
    • exits the smbclient command prompt interface and returns to ScienceCluster;

For a full set of operations with the smbclient tool, execute the command man smbclient and look under the "Operations" section.

Example operations

To download a text file titled test.txt from a NAS device and place it into the directory where you executed the smbclient command, use:

smb: \> get test.txt new_test.txt
In this case, the file test.txt will be copied to your present working directory on ScienceCluster with the new name new_test.txt.

To upload a file from ScienceCluster to the NAS device, use:

smb: \> put new\_test.txt augmented\_test.txt
Relative and absolute paths can be specified in these commands, and pressing the "Tab" key to autocomplete file names and directories also works within the smbclient command prompt interface.