Whatbox Logo
Login for certain variables to be updated with your slot's information

Wiki > Copyparty

Copyparty is a simple yet feature rich file server with a web interface. It can be used to browse your files, to upload new files, to share your files with other people, and even to stream music and videos. It is relatively easy to set up compared to similar programs.

See the README on Copyparty's GitHub page for a full list of features.

Basic Setup

First, use SSH to connect to your slot. Then take the following steps:

  1. Create a new folder in your user directory called "copyparty". Navigate to this folder.
cd ~
mkdir copyparty
cd copyparty
  1. Obtain the latest version of Copyparty, which is packaged as a single Python script called copyparty-sfx.py.
wget 'https://github.com/9001/copyparty/releases/latest/download/copyparty-sfx.py'
  1. Create a Python virtualenv in this directory. Copyparty does not have any required Python dependencies, but this can be used later to install optional ones.
/usr/bin/virtualenv -p python3 --system-site-packages virtualenv
  1. Create a blank configuration file.
touch copyparty.conf
  1. Populate the config file. A good default that you can copy in is provided below. For information on config file syntax, see the relevant section in Copyparty's README file.

This example file defines a single user account, creates a volume for your ~/files directory, and gives you admin privileges for that volume.

Don't forget to replace the text {password} below with a password of your choice.

[global]
    p: 12985  #sets the port number
    xvol  #restricts symlink following, for security

[accounts]
    user:{password}

[/files]
    /home/user/files  #create a volume for the ~/files directory
    accs:
        A: user  #give user admin access to the volume
  1. Create a wrapper script to run Copyparty using your virtualenv and your config file.
cat <<'EOF' > copyparty.sh
#!/usr/bin/bash
cd /home/user/copyparty
venv/bin/python copyparty-sfx.py -c copyparty.conf "$@"
'EOF'
  1. Make the wrapper script executable.
chmod u+x copyparty.sh

And that's it! See the below sections for how to run Copyparty, plus info on setting up some extra features and security enhancements.

Running Copyparty

You can run Copyparty by executing the wrapper script you created. Once it is running it can be accessed in your browser at server.whatbox.ca:{{PORT}.

~/copyparty/copyparty.sh

It is recommended that you run this command using Screen so that you don't need to leave an SSH session running.

screen ~/copyparty/copyparty.sh

NOTE: Your browser will probably warn you that the connection isn't secure when you use the link given above. This is because Copyparty creates a self-signed certificate by default. You can easily fix this by setting up a Whatbox app link, as outlined in the next section of this guide.

You can make your Copyparty instance accessible from a custom Whatbox URL, such as copyparty.user.box.ca. This makes the link easier to remember and enhances security by using Whatbox's own TLS certificate.

  1. Open your copyparty.conf file and add the following flags to the [global] section:

copyparty.conf

[global]
    ...
    no-crt  #disable certificate creation
    rproxy: 1  #enable reverse proxy forwarding header
  1. Go to the Manage Links page listed on your Whatbox slot's Manage page.

  2. Scroll to the bottom of this page and uncollapse the "Add a custom app" section. Enter the following settings and then press the "Add new app" button:

  • App name: copyparty
  • App subdomain: copyparty
  • App port: 12985
  1. Restart Copyparty.

You should now be able to access Copyparty from https://copyparty.user.box.ca and the "insecure connection" warning should be gone.

Improving security with password hashing

You may have noticed that your password is stored in plaintext in the config file that you created. With Whatbox's default permissions only you should have access to this file, but it is considered safer to use password hashing instead.

  1. Install the argon2-cffi Python library in Copyparty's virtualenv.
~/copyparty/virtualenv/bin/pip install argon2-cffi
  1. Open your copyparty.conf file and add the following flag to the [global] section:

copyparty.conf

[global]
    ...
    ah-alg: argon2  #enable password hashing with argon2
  1. Generate the hashed forms of your user password by running Copyparty with the --ah-cli flag. This will will let you enter passwords on the command line.
~/copyparty/copyparty.sh --ah-cli

You can also simply run Copyparty again, and it will print out the hashed forms of all user passwords in its logs as it starts up.

  1. Replace the password(s) in your config file with the hashed form(s). For the example config file in the "Initial Setup" section, this would look something like this:

copyparty.conf

[accounts]
    user:+u0pgU_joK5U3mIKan87ItP94MhMGCK9V
  1. Restart Copyparty.

See Copyparty's README section on password hashing for more.

Enabling Shares

Copyparty can create temporary share links for any file or folder. This is useful for quickly sharing things with other people without creating them a user account. You can also allow writing to folder shares, which lets people upload things to that folder.

Open your copyparty.conf file, add the following flags to the [global] section, and restart Copyparty:

copyparty.conf

[global]
    ...
    shr: /shr  # set the virtual share volume to /shr
    shr-adm: user  # allow user to administrate all shares

When you select a file or folder in the Copyparty interface, there should now be a Share button on the bottom right of the interface.

If you have other Copyparty user accounts in your config file and you don't want them to be able to create shares, you can restrict share creation to admins by adding this extra flag to your config file:

[global]
    shr-who: a  #only allow volume admins to create shares

Copyparty has an advanced search functionality that is not enabled by default. To enable it, simply add the following flag to your copyparty.conf and restart Copyparty:

copyparty.conf

[global]
    ...
    e2dsa

Copyparty will begin indexing your files for search when it is next started. This may take a while depending on how many files you have. Index data is stored in a database in the directory ~/.config/copyparty.