Difference between revisions of "Accessing Swestore with lftp"
(Rewrite for user/pass auth) |
(Rewrite for user/pass auth) |
||
Line 4: | Line 4: | ||
− | + | = Introduction = | |
lftp is an interactive text-mode file transfer tool that understands multiple access protocols. It is commonly available in Linux/Unix environments. | 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 | + | 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. | 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. | 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. | ||
Line 71: | Line 30: | ||
Some sample tasks that can be achieved with lftp is retrieving or uploading single files or whole directory trees. | 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 mirroring the | ||
− | |||
− | |||
For example, the command | For example, the command | ||
− | + | mirror A B | |
will download all of the remote directory ''A'' into the local directory named ''B''. | will download all of the remote directory ''A'' into the local directory named ''B''. | ||
The command | 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. | 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 = | = Credits = | ||
− | This guide was written by Lars Viklund | + | This guide was initially written by Lars Viklund and subsequently revised by Niklas Edmundsson. |
Revision as of 11:17, 11 October 2019
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 mirror
command, mput/mget
and more. Use help
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:
lftp -u username https://webdav.swestore.se/
- 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 lftp
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 cd
command:
cd snic/project_name_here/
Note the trailing / !
Individual files can be manipulated using the get
and put
commands, while mget
and mput
transfers multiple files at once. The mirror
command can transfer whole trees.
The program has interactive help for any command through the help
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.