Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

Make SSH daemon listen on a UNIX socket

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
9 posts • Page 1 of 1
Author
Message
Kaidezee
n00b
n00b
User avatar
Posts: 29
Joined: Wed Dec 25, 2024 6:04 pm
Location: 25.3 N 91.7 E

Make SSH daemon listen on a UNIX socket

  • Quote

Post by Kaidezee » Mon Jun 09, 2025 4:44 pm

There doesn't seem to be an option for that in /etc/ssh/sshd_config (didn't find it in the man entry), so is there some (maybe other) way to make it listen on a UNIX socket (and also maybe prevent it from listening on a TCP port)? Also so that it sticks after reboot.
Top
gentoo_ram
Guru
Guru
Posts: 528
Joined: Thu Oct 25, 2007 10:04 pm
Location: San Diego, California USA

  • Quote

Post by gentoo_ram » Tue Jun 10, 2025 12:07 am

I don't think so. It isn't documented anyway. But you could have it listen only on the loopback interface. That would only allow access from the host itself which is what I guess you want the Unix socket for.

The only other way I could see SSH from a Unix socket is by configuring 'socat' to run in the background forwarding between a Unix socket and the loopback address.
Top
Hu
Administrator
Administrator
Posts: 24385
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Tue Jun 10, 2025 1:50 am

OP: what problem are you trying to solve by restricting the sshd to listen on a local socket?
Top
Kaidezee
n00b
n00b
User avatar
Posts: 29
Joined: Wed Dec 25, 2024 6:04 pm
Location: 25.3 N 91.7 E

  • Quote

Post by Kaidezee » Tue Jun 10, 2025 7:34 am

what problem are you trying to solve by restricting the sshd to listen on a local socket?
None, really. I just wonder if this is possible or not.
Top
sam_
Developer
Developer
User avatar
Posts: 2814
Joined: Fri Aug 14, 2020 12:33 am

  • Quote

Post by sam_ » Thu Jun 12, 2025 9:53 pm

AFAIK, openssh doesn't support this directly, but systemd has a workaround: https://mastodon.social/@pid_eins/112411218075942131.

Mod edit: Trailing period evicted from the above URL. — JRG
Top
Banana
Advocate
Advocate
User avatar
Posts: 2379
Joined: Fri May 21, 2004 12:02 pm
Location: Germany
Contact:
Contact Banana
Website

  • Quote

Post by Banana » Fri Jun 13, 2025 6:11 am

sam_ wrote:AFAIK, openssh doesn't support this directly, but systemd has a workaround: https://mastodon.social/@pid_eins/112411218075942131.
Isn't this just the socket activation which ends up in a running ssh service listening to the specified port?
Forum Guidelines

PFL - Portage file list - find which package a file or command belongs to.
My delta-labs.org snippets do expire
Top
Zentoo
Apprentice
Apprentice
User avatar
Posts: 224
Joined: Mon Nov 18, 2002 5:53 pm
Location: /dev/console

  • Quote

Post by Zentoo » Mon Sep 01, 2025 2:03 pm

Kaidezee wrote:
what problem are you trying to solve by restricting the sshd to listen on a local socket?
None, really. I just wonder if this is possible or not.
Banana wrote:
sam_ wrote:AFAIK, openssh doesn't support this directly, but systemd has a workaround: https://mastodon.social/@pid_eins/112411218075942131.
Isn't this just the socket activation which ends up in a running ssh service listening to the specified port?
Yes it is. And it is not officially supported by openssh upstream as it brings several problems:
- socket activation by default permits to connect on all interfaces
- socket activation with restricted ip/port bind will act like a socat on a local port bind
- no centralised logs as each socket activation will run in a new instance
- socket activation is being susceptible to denial of service
- openssh have retired support of socket activation because of last point with the 8.0p1-3 version

So I think '''Listen 127.0.0.X''' is the way to go.
ACCEPT_KEYWORDS="~amd64"
USE="-systemd -pulseaudio +alsa"
Desktop: openbox|picom|ROX-Filer|wbar|window maker dockapps
Hardware: Ryzen 7950X | 64 Gb | Nvidia 3080Ti
Top
floppymaster
Developer
Developer
User avatar
Posts: 234
Joined: Wed Jul 07, 2010 1:05 am
Location: Detroit, MI, USA

  • Quote

Post by floppymaster » Wed Sep 10, 2025 7:13 pm

Zentoo wrote:- openssh have retired support of socket activation because of last point with the 8.0p1-3 version
I think you may be quoting an AI search result: 8.0p1-3 is version number from Arch Linux, not Gentoo or upstream OpenSSH.

Arch removed sshd.socket from their openssh package.

https://bugs.archlinux.org/task/6224

Gentoo still provides it.
Top
Zentoo
Apprentice
Apprentice
User avatar
Posts: 224
Joined: Mon Nov 18, 2002 5:53 pm
Location: /dev/console

  • Quote

Post by Zentoo » Fri Sep 12, 2025 11:55 pm

floppymaster wrote:
Zentoo wrote:- openssh have retired support of socket activation because of last point with the 8.0p1-3 version
I think you may be quoting an AI search result: 8.0p1-3 is version number from Arch Linux, not Gentoo or upstream OpenSSH.

Arch removed sshd.socket from their openssh package.

https://bugs.archlinux.org/task/6224

Gentoo still provides it.
I don't quote AI that I do not use at all but I found part of these informations effectively on Arch wiki.
See: https://wiki.archlinux.org/title/OpenSS ... management

In fact Arch wiki is wrong on this point:
openssh 8.0p1-3 removed sshd.socket that used systemd's socket activation due to it being susceptible to denial of service.

I presume that it is Arch that have removed socket support from openssh and not openssh upstream.
Furthermore it seems that Gentoo still provides socket support if I refer to this file being installed:

Code: Select all

/lib/systemd/system/sshd.socket
I can't really check on my side if socket activation works on Gentoo as I'm not using systemd but openrc.
ACCEPT_KEYWORDS="~amd64"
USE="-systemd -pulseaudio +alsa"
Desktop: openbox|picom|ROX-Filer|wbar|window maker dockapps
Hardware: Ryzen 7950X | 64 Gb | Nvidia 3080Ti
Top
Post Reply

9 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic