Synchronizing Files with Seafile Using the Linux Command Line Client

Today I managed to get a seafile client running on a Linux server and decided to write the necessary steps down in the hope that this will be helpful.

Installing the Command Line Client

Instructions on how to install seafile-cli: can be found here. For Ubuntu 20.04, the commands are:

1
2
3
4
sudo wget https://linux-clients.seafile.com/seafile.asc -O /usr/share/keyrings/seafile-keyring.asc
sudo bash -c "echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/seafile-keyring.asc] https://linux-clients.seafile.com/seafile-deb/focal/ stable main' > /etc/apt/sources.list.d/seafile.list"
sudo apt update
sudo apt install seafile-cli

Initializing the Configuration Directory

Seafile needs a directory in which configuration data is stored. It is created and initialized as follows:

1
2
3
mkdir ~/seafile-client
seaf-cli init -d ~/seafile-client
seaf-cli start

Synchronizing the Files

The hardest part is to construct the command line for the sync command. It should look like this:

seaf-cli sync -l '1b71943d-392a-d9f2-c336-a2d681956ace' -s 'https://myserver.org' -d '/path/to/local/directory' -u 'user@domain.org' [-p 'MyPassword' -e 'MyLibraryPassword']

Possible pitfalls:

  • The library ID must be provided (as opposed to the library name). To find out the library ID, browse the contents on the Seafile web interface. The ID is part of the URL.
  • Although the documentation states that a user name is required, it is actually the user’s email address that has to be provided. When providing user names, the program fails with the error Bad request
  • If your password contains special characters (and it should!) then it has to be enclosed in single quotes (double quotes do not work)

Note: if passwords are not provided on the command line, the program asks for them during program execution, that’s why they are marked as optional.

That should be it hopefully 😉 Now you can check what the client does in the background with

1
seaf-cli status

Leave a Reply

Your email address will not be published. Required fields are marked *