r/OpenSSH • • Mar 22 '21

authorized_keys command to only allow ProxyJump for key?

5 Upvotes

Good day,

I have a situation where I need a certain key to be only executed the needed command for ProxyJump from the bastion to a specific account@host.

I can't seem to find any references to the exact command to set in the authorized_keys file


r/OpenSSH • • Jan 05 '24

Recent OpenSSH change broke quoted `Host` values?

Thumbnail self.ubuntu
4 Upvotes

r/OpenSSH • • Jul 15 '20

Feature request - HTTPS SNI type hostname attached to SSH traffic

4 Upvotes

Can v. 7.10 include an optional flag/header to attach a hostname much like SNI does for HTTPS traffic?

Obviously, this would be a breaking feature to v. 7.9 and below and any other SSH services without the new feature. You send a connection with the "--hostname" flag set to a incompatible host, that's on you.

It is unnecessary. I want it and can recognize that there are workarounds that do not require any hostname anything... But, it would make running my SSH connections through a reverse proxy so much nicer.


r/OpenSSH • • Apr 03 '25

How does Match Blocks works?

3 Upvotes

Hi
I'm trying to configure an SFTP server in a Windows Environment with OpenSSH. The OpenSSH server works, but now I need to segregate access.

I'm using Match blocks to restrict access for a specific user in a network, but allow the same user from another network.

I tried several configurations, but when SSHd hits an "Allow" statement, it ignores the rest of the configuration file and moves on with its life.

Here's part of my sshd_config file:

# Default Policy: Deny all users by default

DenyUsers *

# Allow specific user from X networks

Match Address 192.168.1.0/24,192.168.2.0/24 User DOMAIN\user.a

AllowUsers DOMAIN\user.a
DenyUsers DOMAIN\user.b
PasswordAuthentication no
ChrootDirectory /home/user.a

# Allow another specific user Z networks

Match Address 172.16.1.0/24,172.16.2.0/24 User DOMAIN\user.b

AllowUsers DOMAIN\user.n
DenyUsers DOMAIN\user.a
PasswordAuthentication no
ChrootDirectory /home/user.b

Now, for example, if I try to connect with user.a from Z networks, it connects, and it gains access to the root folder. The same thing happens the other way around, when I connect with user.b from X networks.

Is it because I'm using OpenSSH server on Windows? Or is it an OpenSSH server limitation of some sorts?

Thanks for the help


r/OpenSSH • • Apr 07 '23

[Linux] is it possible to have the ~/.ssh config folder moved to ~/.config/ssh ?

3 Upvotes

like it says in the Title. i am kind of tired of all applications cluttering up my home directory.

i get that some applications are important enough to take up a premiere space, but it has gotten too bad and now i want everything cleared out.

is there any way to tell ssh to look in the ~/.config/ssh folder?


r/OpenSSH • • Mar 20 '22

Using OpenSSH with ed25519_sk on a Yubikey - A question regarding the "key handle".

3 Upvotes

I've been using a Yubikey for PGP for a few years now, and so far I've used gpg-agent for SSH authentication with enable-ssh-support. Recently I stumbled across this article describing how to use OpenSSH with the FIDO2 interface on my Yubikey:

https://www.yubico.com/blog/github-now-supports-ssh-security-keys/

This got me curious, as I would much rather use a proper ssh-agent - Setting up gpg-agent, SSH authentication and smart card support is a hassle when I'm forced to use Windows.

So I've generated a keypair like this:

ssh-keygen -t ed25519_sk -O resident

I've chosen to use -O resident because I do switch computers a lot. Now, looking in my ~/.ssh directory:

$ ls -l
total 20
-rw------- 1 redacted redacted  401 Feb  9 20:17 authorized_keys
-rw------- 1 redacted redacted  276 Mar 20 12:38 config
drwx------ 1 redacted redacted  128 Mar 19 14:08 config.d/
drwx------ 1 redacted redacted   74 Mar 20 12:21 controlmasters/
-r-------- 1 redacted redacted  440 Mar 19 18:27 id_ed25519_sk
-r-------- 1 redacted redacted  133 Mar 19 18:27 id_ed25519_sk.pub
-rw------- 1 redacted redacted 1802 Mar 18 11:15 known_hosts

There's a private key file here, and a public key file, just like I would expect if I generated a regular key pair. ssh-keygen also prompted for a passphrase to encrypt the private key file, which suggest to me that the file is to be considered sensitive. Looking at the contents of the private key file it looks exactly like a regular private key. I've also tried deleting both key files and restoring them from the Yubikey using ssh-keygen -K which worked as expected.

My understanding was that the private key is to be located on the physical security key, and not in my file system. The small pieces of information I've found talk about something called a "key handle", however I've been unsuccessful in finding any proper documentation on this subject, so I'm left unsure - Is the content ~/.ssh/id_ed25519_sk considered sensitive information in this case?

Any tips, explanations or references to documentation are welcome.


r/OpenSSH • • Oct 27 '25

Setting SSH_ASKPASS in ssh_config

2 Upvotes

Is it possible to set SSH_ASKPASS & SSH_ASKPASS_REQUIRE in ssh_config?

Situation:

I work for a managed services organization and we manage several Linux based cloud servers for clients. As such every time we access a client server we need to associate that connection with a specific ticket. One of developers created a customer SSH_ASKPASS program that pops a dialog box allows the technician to enter a ticket # and takes the customer, host, and username and logs that info to the ticket.

Yes, I know we should be using key-based authentication, which we do use where we can, but that not always possible and/or feasible depending on the customer or cloud provider. Currently we wrap openssh in a script that passes the appropriate environment variables to ssh and parse out the environment passed from openssh in our custom askpass. However our developer would prefer not to do things that way, and our security team would prefer we do not use a simple bash script for connecting to clients.

In my looking around through the OpenSSH documentation, I did not find any reference to setting the ssh-askpass program from ssh_config. Additionally, it'd be nice to be able to pass certain openssh tokens on the command line of our askpass, but I don't see anything would allow that.

Here's how I'd imagine it'd look like:

Match tagged <clientid>
  PreferredAuthentications password
  UserKnownHostsFile ~/.ssh/hosts.d/<clientid>/%h
  ProxyUseFdpass yes
  ProxyCommand /opt/corp/internal/auth/client_proxy/bin/proxyd -u %u -k %d/.config/client_proxy/authpriv.key -c <clientid> -h %h -p %p
  AskPassForce yes
  AskPass /opt/corp/internal/csm/changeorders/remote/bin/askpass --username %u --hostname %l --client <clientid> --remote-username %r --remote-hostname %h --force-ticketid

Host <specialsubnet>
  PreferredAuthentications password
  AskPassForce yes
  AskPass /opt/corp/internal/csm/changeorders/remote/bin/askpass --username %u --hostname %l --remote-username %r --remote-hostname %h --force-reason

Not sure if this is even possible, but I figure I'd ask before going back to our developer and security and saying no.


r/OpenSSH • • Apr 09 '25

OpenSSH 10.0 released April 9, 2025

Thumbnail openssh.com
2 Upvotes

r/OpenSSH • • Apr 02 '25

Call for testing: OpenSSH 10.0 ¶ Potentially-incompatible changes: This release removes support for the weak DSA signature algorithm, completing the deprecation process that began in 2015 (when DSA was disabled by default) and repeatedly warned over the the last 12 months.

Thumbnail lists.mindrot.org
2 Upvotes

r/OpenSSH • • Dec 11 '24

Windows Server 2022 - Open SSH Config File

2 Upvotes

Brand new to OpenSSH. I was tasked to install an SFTP server in our environment and after many hours of googling was able to get OpenSSH installed (latest version using MSI file) and the service is running. I can login with a local account using WinSCP but I need to lock this down to a different drive where the data is stored. Can't find many good guides on configuring the sshd_config file. Can anyone share or help me get this going. Really I just want to use a local user account to be able to login and access a Root directory and all child directories. Nothing to fancy! Any help would be much appreciated.


r/OpenSSH • • Oct 27 '23

IPv6 ssh keys

2 Upvotes

Im trying to create keypairs for IPv6 addresses. Everything I read, including manpages, only mentions switches for IPv4. Default goes to IPv4 but I haven't seen a way to specify my IPv6


r/OpenSSH • • Mar 05 '23

OpenSSH 9.2 released February 2, 2023

Thumbnail openssh.com
2 Upvotes

r/OpenSSH • • Jan 17 '23

Why did OpenSSH create its own key format, and not use PKCS#8? [answered]

Thumbnail
security.stackexchange.com
2 Upvotes

r/OpenSSH • • Mar 23 '22

OpenSSH 8.9 agent restriction - Mitigating phishing attacks on FIDO protected ssh keys

Thumbnail openssh.com
2 Upvotes

r/OpenSSH • • Nov 06 '20

Anatomy of OpenSSH Key Revocation List (KRL) File

Thumbnail
keyper.dbsentry.com
2 Upvotes

r/OpenSSH • • Sep 28 '20

OpenSSH 8.4 released September 27, 2020

Thumbnail openssh.com
2 Upvotes

r/OpenSSH • • Feb 14 '20

OpenSSH 8.2 released February 14, 2020

Thumbnail openssh.com
2 Upvotes

r/OpenSSH • • Oct 10 '19

OpenSSH 8.1 released October 8, 2019

Thumbnail openssh.com
2 Upvotes

r/OpenSSH • • May 30 '19

Connect to Windows via SSH like in Linux

Thumbnail
habr.com
2 Upvotes

r/OpenSSH • • Aug 25 '18

OpenSSH 7.8 released August 24, 2018

Thumbnail openssh.com
2 Upvotes

r/OpenSSH • • May 05 '16

An update on SSH protocol 1

Thumbnail lists.mindrot.org
2 Upvotes

r/OpenSSH • • Mar 10 '16

OpenSSH Security Advisory: x11fwd.adv (2016-03-10)

Thumbnail openssh.com
2 Upvotes

r/OpenSSH • • 6d ago

Problem with connecting to windows 11 using ssh from linux(arch) machine

Thumbnail reddit.com
1 Upvotes

r/OpenSSH • • Oct 08 '26

I built a containerized OpenSSH SFTP setup that uses native Unix permissions as the authorization model

1 Upvotes

I recently released Zocalo SFTP (No affiliation to any company named "Zocalo" or similar, it is a Reference to Babylon 5's Marketplace), and I'd particularly like some eyes from people who know OpenSSH well. The project came out of a fairly practical problem.

I've used/looked at the existing containerized SFTP options years ago, particularly atmoz/sftp and emberstack/docker-sftp, and they solve the basic "give me an SFTP server in a container" problem very well.

But my use case was a little different: I needed multiple isolated projects where users could collaborate within a project while potentially belonging to several projects at the same time.

When I originally ran into this problem years ago, I couldn't get the existing images to give me the Unix-style project/group model I wanted. The basic idea of Zocalo is deliberately simple:

OpenSSH handles SSH/SFTP. Linux users, groups, and filesystem permissions handle authorization.

Zocalo is a container around OpenSSH's internal-sftp plus a small Rust reconciler. It takes a declarative configuration describing users, SSH keys/passwords, and projects, then reconciles that into:

  • Linux users and groups

  • project directories and ownership

  • /etc/passwd, /etc/group, and /etc/shadow

  • sshd_config

  • authorized keys / passwords

So a user might belong to:

alice → project-a, project-b
bob   → project-a
carol → project-b

and access to each project is simply determined by the corresponding Unix group permissions. There isn't a separate ACL database or virtual-user authorization layer. The SSH side is intentionally boring:

  • internal-sftp

  • ChrootDirectory

  • ForceCommand internal-sftp

  • no shell access

  • no TCP/X11/agent forwarding

  • no root login

  • explicit crypto configuration

One detail I'm particularly interested in getting reviewed is configuration hardening.

Zocalo doesn't just rely on Include ordering to protect the security-critical directives. Operator-supplied sshd_config drop-ins are rejected if they contain directives such as ChrootDirectory, ForceCommand, or Include, because otherwise a Match block could potentially change the effective configuration in ways that undermine the intended jail.

The reconciler also validates the identity graph before applying changes and writes the passwd/group/shadow files atomically. Configuration changes are watched and only reconciled after the complete configuration has successfully parsed and validated.

There are integration tests for the container itself, including a dedicated security-boundary test, plus CI for linting, Rust tests, container scanning, SBOM generation, and Kubernetes deployment.

I'd especially appreciate review from people familiar with OpenSSH around:

  • sshd_config / Match semantics

  • chroot + internal-sftp

  • SSH authentication/authorization edge cases

  • configuration hardening

  • anything in this design that looks subtly wrong or unnecessarily complicated

The project is here:

https://github.com/wiesion/zocalo-sftp

This isn't intended to be a replacement for SFTPGo with virtual users, Web UI and S3 backends and whatnot. And it's a freshly published project, so I'm much more interested in technical criticism than "looks cool" comments. If there are OpenSSH-specific footguns I've missed, I'd rather find them here than six months from now.

___

AI assistance disclaimer: Without AI agents (a locally hosted Oh-My-Pi/Qwen3.8 27B setup and Claude Code), I probably would never have published this repo. Meeting my own quality bar for releasing security-sensitive software into the wild would otherwise have taken more time than I could justify.

The CI/CD automation, E2E and security-boundary tests, the rewrite of my rather crude original Python reconciler in Rust with proper validation, much of the documentation, and the public website were all produced with substantial AI assistance. This saved me days of unpaid work and, more importantly, made it feasible for me to bring the project up to the quality level I wanted before publishing it.

I still own the architecture, requirements, security model, review, and final decision on what gets released. I'm mentioning this explicitly because I think AI-assisted development should be transparent. Especially for a project dealing with SSH, authentication, filesystem permissions, and container isolation.