AAU It Services

SFS using command line (linux)

SFS using command line (Linux)

The Secure File Service (SFS) allows for SFTP and SCP connections to files. This guide demonstrates file transfer of both from an Ubuntu terminal.

 

SFTP

To connect to the file servers with SFTP use the following command from a terminal:

sftp -oGSSAPIAuthentication=no -oCheckHostIP=no "USERNAME@DEP.aau.dk"@SFSSERVER

Where

  • USERNAME@DEP.aau.dk is your AAU-username
  • SFSSERVER is the name of one of the SFS servers
    • sfs01.aau.dk port 22
    • sfs02.aau.dk port 22
  • The parameters -oGSSAPIAuthentication=no and -oCheckHostIP=no are not necessary but speed up the connection process considerably by ignoring Kerberos authentication and host IP verification, respectively. Alternately, if your computer is domain-joined, you can set -oGSSAPIAuthentication=yes and omit your username to automatically detect and authenticate.
  • You may be prompted to accept the SFS server's key. This is a necessary security measure. Simply type 'yes' in the prompt and press enter.
  • Finally, your password is requested.

 

Navigation and file transfer

From this point on, usage is similar to regular command lines. For a complete list of supported commands, simply invoke help on the sftp command line. A few common examples are given here.

  • cd  -  change the current directory, e.g. cd /student/Users/jborre15/Documents
  • ls or dir  -  list the contents of the current directory.
  • lcd   -  change the local directory used for file transfers , e.g. lcd /home/istuser/
  • Get and put are used to download or upload files between the local and remote directories, e.g.
    • get Documents/process.pdf (retrieve remote file process.pdf in relative directory Documents)
    • put process.pdf (upload local file process.pdf to current working directory on remote)
  • rm  - deleting files , e.g. rm process.pdf
  • bye  - quit sftp

 

SCP

SCP (Secure Copy) is an alternative with fewer features, well suited for scripts or simple one-off invokations. The scp command, widely available on Linux distributions, is very similar to the Linux cp command (for local file copies). It only facilitates file transfers, not directory traversal or listing. Thus it is necessary to know the full remote path you are working with prior to invoking the command.

The following command will transfer a local file to a remote server:

scp -oGSSAPIAuthentication=no -oCheckHostIP=no local.file "USER@DEP.aau.dk"@SFS:/DEP/Users/USER/path/to/folder

Downloading a file is almost the same command:

scp -oGSSAPIAuthentication=no -oCheckHostIP=no "USER@DEP.aau.dk"@SFS:/DEP/Users/USER/path/to/remote.file remote.file

Note the same options as used for SFTP to reduce connection times, and as with SFTP you may be prompted to accept a security key the first time you connect to a server.

 

For the advanced user

To avoid setting the options every time, and shortening the commands considerably, consider placing a host entry in the local SSH config file, located in ~/.ssh/config - the local configuration file for the current user. An entry could look like the image below.

In the future simply replace "USERNAME@DEP.aau.dk"@SFSSERVER with aausfs.