Skip to content

Fix sshd port configured test failing on ubuntu base image due to permission errors#162

Merged
sebst merged 2 commits intomainfrom
copilot/fix-sshd-port-configuration
Mar 22, 2026
Merged

Fix sshd port configured test failing on ubuntu base image due to permission errors#162
sebst merged 2 commits intomainfrom
copilot/fix-sshd-port-configuration

Conversation

Copy link
Contributor

Copilot AI commented Mar 22, 2026

grep -r 'Port 2222' /etc/ssh/ recursively hits SSH host private key files (ssh_host_*_key) which are root-readable only. GNU grep exits with code 2 (error) when it encounters permission denied — even when the pattern is found — causing the test to fail.

Changes

  • test/sshd/test.sh: Narrow the grep target to only the sshd config locations instead of the entire /etc/ssh/ directory
- check "sshd port configured" bash -c "grep -r 'Port 2222' /etc/ssh/"
+ check "sshd port configured" bash -c "grep -r 'Port 2222' /etc/ssh/sshd_config /etc/ssh/sshd_config.d/"
Original prompt

This section details on the original issue you should resolve

<issue_title>Test for sshd feature fails on mcr.microsoft.com/devcontainers/base:ubuntu</issue_title>
<issue_description>See: https://github.com/devcontainer-community/devcontainer-features/actions/runs/23401024666/job/68074354934#logs

[2026-03-22T11:16:46.606Z] Container started
🚀 Launched container.
>  containerId:          f89df615d6cca11b68caacde18b3b78f76a53633519db5993ff174344f3d733e
🏃 Starting test(s)...
🧪 Starting 'sshd' tests...
🔄 Testing 'sshd installed'

/usr/sbin/sshd
✅  Passed 'sshd installed'!
🔄 Testing 'openssh version'

OpenSSH_9.6p1 Ubuntu-3ubuntu13.15, OpenSSL 3.0.13 30 Jan 2024
✅  Passed 'openssh version'!
🔄 Testing 'sshd port configured'

grep: /etc/ssh/ssh_host_ed25519_key: Permission denied
grep: /etc/ssh/ssh_host_rsa_key: Permission denied
/etc/ssh/sshd_config.d/devcontainer.conf:Port 2222
grep: /etc/ssh/ssh_host_ecdsa_key: Permission denied
❌ sshd port configured check failed.
🧪 Executing duplicate test for feature 'sshd'...
⚠️ Skipping duplicate test for sshd because '/home/runner/work/devcontainer-features/devcontainer-features/test/sshd/duplicate.sh' does not exist.
🧹 Cleaning up 1 test containers...
🧹 Removing container f89df615d6cc...
  ================== TEST REPORT ==================
❌ Failed:      'sshd'
Error: Process completed with exit code 1.
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

Copilot AI changed the title [WIP] Fix sshd port configuration test failure on ubuntu base image Fix sshd port configured test failing on ubuntu base image due to permission errors Mar 22, 2026
Copilot AI requested a review from sebst March 22, 2026 11:20
@sebst sebst marked this pull request as ready for review March 22, 2026 11:24
@sebst sebst merged commit a010851 into main Mar 22, 2026
7 checks passed
@sebst sebst deleted the copilot/fix-sshd-port-configuration branch March 22, 2026 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test for sshd feature fails on mcr.microsoft.com/devcontainers/base:ubuntu

2 participants