3

I'm trying to build a private apt repository using reprepro. I managed to get password-less SSH login after creating a SSH key chain. I can successful login to the repository if I SSH into it.

On the client machine I added the repository in the apt sources list like:

deb ssh://repo@192.168.60.128:/home/repo/repos/apt/ubuntu xenial main

But when I try to use apt-get update, I still need to enter the password otherwise it won't proceed. It only shows:

100% [Connecting to repo@192.168.60.128]

Is there a way that apt can use my key get access to the repository without entering a password?

amc
  • 7,292

2 Answers2

1

I solved this problem by creating a ssh key as root on the client machine. After that i needed to add this public key to the authorized_keys on the ubuntu server machine. Now I can make use of the apt repository using ssh with the keys without entering a password.

0

You need to add the command to /etc/sudoers. Have a look at this How do I run specific sudo commands without a password?

Another option is to ssh passwordless with the root user but, it's generally considered a very bad idea. How to setup passwordless SSH access for root user

In your repo, become root with sudo su and then run this command:

echo "%sudo ALL=NOPASSWD: /usr/bin/apt-get" >> /etc/sudoers

This will allow any user to run apt-get without password. This command is used to upgrade, but it can also be used to install/uninstall packages... be careful. I think it would be better to use the password or enable automatic updates in the server.

Katu
  • 3,663