Difference between revisions of "Accessing Swestore with lftp"

From SNIC Documentation
Jump to: navigation, search
(Add statement of lftp unsuitable for Swestore use)
(Swestore documentation moved)
(Tag: New redirect)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:Swestore]]
+
#REDIRECT[[Swestore Documentation Moved]]
[[Category:Swestore user guide]]
 
[[Swestore|< Swestore]]
 
 
 
= Status =
 
 
 
Current lftp version as shipped in most Linux distributions are having issues in presenting a directory listing that makes sense to users, among the issues is a tendency to mix files from the root directory and the current directory.
 
 
 
As such, we recommend that '''lftp is not used for file transfers from/to Swestore'''.
 
 
 
= Introduction =
 
 
 
lftp is an interactive text-mode file transfer tool that understands multiple access protocols. It is commonly available in Linux/Unix environments.
 
 
 
The benefit over tools like cURL is that it has interactive traversal of the directory hierarchy, as well as powerful mass-transfer functionality like the <code>mirror</code> command, <code>mput/mget</code> and more. Use <code>help</code> in lftp for details. This is not intended to be a complete lftp usage howto, refer to tutorials online for this.
 
 
 
This guide explains how to use lftp with username/password authentication.
 
 
 
= Authenticate using username/password =
 
 
 
* Prerequisite: Username and password, see [[Setting your Swestore password]]
 
* Open a terminal window
 
* Start lftp with: '''<code>lftp -u username https://webdav.swestore.se/</code>'''
 
* Enter your password at the prompt
 
** '''NOTE:''' Password will be verified on first command/connection, so typing the wrong password will error out later!
 
 
 
= Usage =
 
 
 
There are some quirks that lftp has together with the Swestore WebDAV door.
 
 
 
When giving a directory path to a command, it should end with a trailing slash to indicate that it is a directory. If this is omitted, the client will get a redirection response that the tool doesn't handle properly.
 
 
 
All the commands mentioned in this section and the previous configuration section are commands inside of a running <code>lftp</code> program.
 
 
 
Some sample tasks that can be achieved with lftp is retrieving or uploading single files or whole directory trees.
 
 
 
Navigate around with the use of the <code>cd</code> command:
 
cd snic/project_name_here/
 
Note the trailing / !
 
 
 
Individual files can be manipulated using the <code>get</code> and <code>put</code> commands, while <code>mget</code> and <code>mput</code> transfers multiple files at once. The <code>mirror</code> command can transfer whole trees.
 
 
 
The program has interactive help for any command through the <code>help</code> command.
 
 
 
For mirroring the flag ''-R'' is particularly relevant as ''-R'' controls the direction of the operation - if it is present the transfer is mirroring '''to''' the server, otherwise it's mirroring '''from''' the server.
 
 
 
For example, the command
 
mirror A B
 
 
 
will download all of the remote directory ''A'' into the local directory named ''B''.
 
 
 
The command
 
mirror -R C D
 
 
 
will upload all of the local directory ''C'' into the remote directory named ''D''. Note that the role of the directories is reversed compared to the previous example.
 
 
 
= Credits =
 
 
 
This guide was initially written by Lars Viklund and subsequently revised by Niklas Edmundsson.
 

Latest revision as of 09:59, 8 February 2023