I wanted to create a new private APT repository on my VPS. To secure it I have decided to connect via ssh and authenticate by private/public keys.

So on VPS I created a new account: repo-usr

useradd -m -d /home/repo-usr -s /bin/false repo-usr

After that as a root I generated keys via gpg as a root

sudo su
gpg --key-gen

So I retrieved a keyid, let's say 1234

Then I cd into home of the repo-usr and create a repository there

cd /home/repo-usr
mkdir -p ubuntu/conf

And create two files inside conf.


Codename: xenial
Architectures: amd64
Components: main
SignWith: 1234 



I add some package to repo via:

reprepro -b /home/repo-usr/ubuntu includedeb xenial main foo.deb

On my client computer I generate ssh key pair for repo-usr and put the public key in authorized keys on server side (in /home/repo-usr/.ssh/authorized_keys) The generated private key I transfer to root on client. I believe I have successfully authenticated however I am not sure.

In /etc/apt/sources.list I add:

deb ssh://repo-usr@sever.com:/home/repo-usr/ubuntu xenial main

And after cleaning apt cache and running apt-get update I see that apt just ignores the packages.

Ign:19 ssh://server.com/home/repo-usr/ubuntu xenial/main amd64 Packages
Ign:20 ssh://server.com/home/repo-usr/ubuntu xenial/main i386 Packages    

and so on... On top of that I get

Failed to fetch ssh://server.com/home/repo-usr/ubuntu/dists/xenial/main/binary-amd64/Package Read error - read(0: Success)

However Package file exists there and looks fine.

Does anyone have any idea what am I doing wrong? Is the set up mentioned above correct for such scenario?


The repo-usr must be provided with a shell.

usermod -s /bin/bash repo-usr

fixed the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.