Access repositories in Debian, Ubuntu or derivatives by SSH and not by HTTP / FTP

The most normal thing in the world is that we configure our repos in Debian, Ubuntu or derivatives pointing to the official repos via HTTP or FTP, that is, I edit the file /etc/apt/sources.list and put something like this:

deb http://repos.mired.net/ubuntu-precise/ precise universe multiverse restricted

Or with Debian:

deb ftp://repos.mired.net/debian/wheezy/ wheezy main contrib non-free

And this is fine, there is nothing wrong with it.

The point is that sometimes we need to update and install software on a home computer or, for example, on a server of our company, and we need to do this without many complications, without having to install a web server (Apache, Nginx, etc. ) on our FTP server (Updating from the internet is ruled out many times because it consumes bandwidth and time, in addition, when using the browser to find the route of the repository we can entertain ourselves with some type of free ads), we need to update and voila, not having to install Apache or pure-ftpd, far from it ... for this we can use SSH.

SSH is the way we control our computers remotely, it is a service that is installed by default on each server, well, to tell X server / computer that it should use the repos located on server Y, we configure our / etc / apt /sources.list as follows:

deb ssh://root@repos.mired.cu:/var/www/ftp/repos/debian/wheezy/ wheezy main contrib non-free

As you can see, the startup deb is kept, then we change http / ftp to ssh, followed by the user with which it will be accessed and the server that will be accessed, then we indicate exactly the location of the repository using: / path as shown on the line, then we have the usual, the version of the distro and the branches of the repo.

Then there is the usual thing:

apt-get update

And that is where it will not be updated automatically, that is, when you tell the system to use that repository via SSH, the system will ask you if you want to add SSH to the known servers to this new one, they indicate yes by typing yes and pressing Enter, then it will ask for the root password and when you put it, the process of updating the indexes will begin, which is what they indicated 🙂

This has been really useful for me, because I have my virtual server configured like this (I use Arch, but my virtual server uses Debian), it still saves a lot of work or bandwidth, right? 🙂

Anyway ... I hope this has been useful for you 😀

regards


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

6 comments, leave yours

Leave a Comment

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

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   FIXOCONN said

    A coworker from here would tell you "you're a tiger"
    thanks for the post it looks tailor made for us (.cu)

  2.   neo61 said

    Well how good. A great contribution like all those you publish. I would like some help and it is regarding updating a repo from home, how should the line be structured in that case of the sources.list?

    1.    KZKG ^ Gaara said

      Assuming the repo is in / home / neo / Linux / debian-repo it would be:

      deb ssh://root@mipc:/home/neo/Linux/debian-repo/ wheezy main contrib non-free

      1.    neo61 said

        Sorry for the delay, I had not marked so that I was notified by mail, thanks partner for your contributions and explanation. As some Mexican of "padre guey" would say

  3.   jc852654 said

    I have my sources.list file in sources.list.d
    As follows:

    #Put this file in /etc/apt/sources.list.d/

    # SSH-Start of /etc/apt/sources.list file for desktop or lap machines $
    deb ssh: // c3uz @ VODK: / media / USBDEB / debian / debian / wheezy main contrib non-free
    deb-src ssh: // c3uz @ VODK: / media / USBDEB / debian / debian / wheezy main contrib non-f $

    deb ssh: // c3uz @ VODK: / media / USBDEB / debian / debian / wheezy-updates main contrib n $
    deb-src ssh: // c3uz @ VODK: / media / USBDEB / debian / debian / wheezy-updates main contr $

    deb ssh: // c3uz @ VODK: / media / USBDEB / debian / debian-security / wheezy / updates main $
    deb-src ssh: // c3uz @ VODK: / media / USBDEB / debian / debian-security / wheezy / updates m $

    #Backports
    deb ssh: // c3uz @ VODK: / media / USBDEB / debian / debian-backports / wheezy-backports mai $

    # SSH-Multimedia
    deb ssh: // c3uz @ VODK: / media / USBDEB / debian / debian-multimedia / wheezy main non-free

    # Iceweasel-realease
    deb ssh: // c3uz @ VODK: / media / USBDEB / debian / debian-mozilla / wheezy-backports icewe $

    #End of file /etc/apt/sources.list

    But it doesn't totally work for me.
    You can help

    this is the output when executing "# aptitude update"
    Ign ssh: // c3uz @ VODK wheezy-backports Release.gpg
    Hit ssh: // c3uz @ VODK wheezy Release.gpg
    Ign ssh: // c3uz @ VODK wheezy-backports Release.gpg
    Ign ssh: // c3uz @ VODK wheezy-backports Release
    Hit ssh: // c3uz @ VODK wheezy Release
    Ign ssh: // c3uz @ VODK wheezy-backports Release
    Hit ssh: // c3uz @ VODK wheezy / main amd64 Packages
    Hit ssh: // c3uz @ VODK wheezy / non-free amd64 Packages
    Hit ssh: // c3uz @ VODK wheezy / main Translation-en
    Hit ssh: // c3uz @ VODK wheezy / non-free Translation-en
    Ign ssh: // c3uz @ VODK wheezy / main Translation-en
    Err ssh: // c3uz @ VODK wheezy-backports / main amd64 Packages
    File not found
    Err ssh: // c3uz @ VODK wheezy-backports / contrib amd64 Packages
    File not found
    Err ssh: // c3uz @ VODK wheezy-backports / non-free amd64 Packages
    File not found
    Ign ssh: // c3uz @ VODK wheezy-backports / contrib Translation-en_ES
    Ign ssh: // c3uz @ VODK wheezy-backports / contrib Translation-en
    Ign ssh: // c3uz @ VODK wheezy-backports / contrib Translation-es_SV
    Ign ssh: // c3uz @ VODK wheezy-backports / contrib Translation-en
    Ign ssh: // c3uz @ VODK wheezy-backports / main Translation-es_ES
    Ign ssh: // c3uz @ VODK wheezy-backports / main Translation-en
    Ign ssh: // c3uz @ VODK wheezy-backports / main Translation-es_SV
    Ign ssh: // c3uz @ VODK wheezy-backports / main Translation-en
    Ign ssh: // c3uz @ VODK wheezy-backports / non-free Translation-es_ES
    Ign ssh: // c3uz @ VODK wheezy-backports / non-free Translation-en
    Ign ssh: // c3uz @ VODK wheezy-backports / non-free Translation-es_SV
    Ign ssh: // c3uz @ VODK wheezy-backports / non-free Translation-en
    Err ssh: // c3uz @ VODK wheezy-backports / iceweasel-release amd64 Packages
    File not found
    Ign ssh: // c3uz @ VODK wheezy-backports / iceweasel-release Translation-en_ES
    Ign ssh: // c3uz @ VODK wheezy-backports / iceweasel-release Translation-en
    Ign ssh: // c3uz @ VODK wheezy-backports / iceweasel-release Translation-es_SV
    Ign ssh: // c3uz @ VODK wheezy-backports / iceweasel-release Translation-en

    1.    jc852654 said

      This is the structure on the USB hard drive from which I am getting the data
      ├── debian
      │ ├── debian
      │ │ ├── dists
      │ │ │ ├── oldstable -> squeeze
      │ │ │ ├── squeeze
      │ │ │ ├── stable -> wheezy
      │ │ │ └── wheezy
      │ │ ├── pool
      │ │ │ ├── contrib
      │ │ │ ├── main
      │ │ │ └── non-free
      │ │ └── project
      │ │ └── trace
      │ ├── debian-backports
      │ │ └── dists
      │ │ └── squeeze-backports
      │ ├── debian-mozilla
      │ │ └── dists
      │ │ ├── squeeze-backports
      │ │ └── wheezy-backports
      │ ├── debian-multimedia
      │ │ ├── dists
      │ │ │ ├── oldstable -> squeeze
      │ │ │ ├── squeeze
      │ │ │ ├── stable -> wheezy
      │ │ │ └── wheezy
      │ │ ├── pool
      │ │ │ ├── main
      │ │ │ └── non-free
      │ │ └── project
      │ │ └── trace
      │ └── debian-security
      │ ├── dists
      │ │ ├── squeeze
      │ │ └── wheezy
      │ ├── pool
      │ │ └── updates
      │ └── project
      │ └── trace