Use dput-ng to Upload Debian Packages to a Private Reprepro Repository

1 Install dput-ng

$ sudo apt install dput-ng

2 Configure SSH Login with a Key

If you have already set up SSH private key login to your Reprepro server, please skip this step.

2.1 Generate a SSH Key Pair

If you already have a SSH key pair in the default location, please skip this step.

Generate your SSH key pair by executing

$ ssh-keygen

You will be prompted to choose the location to store the keys. Press Enter to use the default.

Then you will be prompted to choose a password. Press Enter twice to use the empty password.

2.2 Copy the SSH Public Key

Copy the SSH public key to your Reprepro server by

$ ssh-copy-id [email protected]_host

Replace username with your actual username used to log into the server and reprepro_host with the hostname of your server.

You will be prompted to enter your server login password.

2.3 Test Your Key Setup

Test your key setup by executing

$ ssh [email protected]_host

If the setup is successful, you will get directly into the server shell without entering a password.

3 Configure dput-ng

$ sudo nano /etc/dput.d/profiles/myrepo.json
"fqdn": "",
"incoming": "/var/www/html/debian/incoming",
"login": "username",
"meta": "debian",
"method": "sftp",
"allow_unsigned_uploads": true

To suit your needs, you may

  • Set login to your actual username used to log into your private Repropro server via SSH.
  • Set fqdn to the hostname of your private Reprepro server.
  • Set incoming to the incoming directory configured on your Reprepro server.
  • Set allow_unsigned_uploads to false to disallow unsigned uploads.

4 Upload Your Packages

To upload your packages. simply execute

$ dput myrepo package.changes

dput will parse package.changes file and upload relevant debs to the incoming directory of Reprepro server via SFTP.

Your server should have a script that periodically checks the incoming directory for new packages. If there are new ones, the script will add them to the Reprepro repository.

5 Troubleshooting

5.1 dput-ng SFTP error

dput-ng may show this error when you attempt to upload packages to your server.

SFTP error uploading to reprepro_server: SSHException('not a valid RSA private key file')

The reason is that dput-ng uses an old version of paramiko library which does not support OpenSSH keys created by ssh-keygen using the default options. To work around this problem, we have to convert OpenSSH keys to RSA by

$ ssh-keygen -p -m PEM -f ~/.ssh/id_rsa