Giter Site home page Giter Site logo

Comments (16)

thespad avatar thespad commented on July 26, 2024 1

There's an open PR (#42) but it's waiting on the submitter to make the necessary documentation changes.

I think they got bored.

from docker-openssh-server.

github-actions avatar github-actions commented on July 26, 2024

Thanks for opening your first issue here! Be sure to follow the issue template!

from docker-openssh-server.

github-actions avatar github-actions commented on July 26, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from docker-openssh-server.

cwong-openfit avatar cwong-openfit commented on July 26, 2024

hmm. i have the same issue. i set the port to 2223 but the issue is the script is hardcoded to 2222

from docker-openssh-server.

cwong-openfit avatar cwong-openfit commented on July 26, 2024

thank you! :D

from docker-openssh-server.

LDAP avatar LDAP commented on July 26, 2024

Until #42 is merged, this is my workaround:

Create a file custom-port.sh in <config-path>/custom-cont-init.d/ with:

#!/bin/bash

# Replace 22 with your custom port
sed -i 's/-p 2222/-p 22/' /etc/services.d/openssh-server/run

from docker-openssh-server.

cwong-openfit avatar cwong-openfit commented on July 26, 2024

ya. i did the same last eve.

sed -i -e 's/^USER_NAME=.*/USER_NAME=root/' -e 's/2222$/22/' /etc/services.d/openssh-server/run

i had to change the USER_NAME=root because i was getting perm denied as the regular user (911).
which i also had to change the perm and ownership of the ssh_host* files as well.

from docker-openssh-server.

github-actions avatar github-actions commented on July 26, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from docker-openssh-server.

andryyy avatar andryyy commented on July 26, 2024

Doing it like this rn in a custom init script:

sed -i 's/2222/{{ env "NOMAD_PORT_[[ $task.name ]]" }}/' /etc/s6-overlay/s6-rc.d/svc-openssh-server/run
sed -i 's/2222/{{ env "NOMAD_PORT_[[ $task.name ]]" }}/' /var/run/service/svc-openssh-server/run.user

Feels dirty.

Another approach is to run socat:

socat TCP-LISTEN:{{ env "NOMAD_PORT_[[ $task.name ]]" }},fork,reuseaddr TCP:127.0.0.1:2222 &

One should consider putting that in a loop, I guess (getting dirty again):

(
while true; do
  socat TCP-LISTEN:{{ env "NOMAD_PORT_[[ $task.name ]]" }},fork,reuseaddr TCP:127.0.0.1:2222
done
) &

from docker-openssh-server.

github-actions avatar github-actions commented on July 26, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from docker-openssh-server.

koraa avatar koraa commented on July 26, 2024

bump. This is still highly desired. Not having a port config option in a server ist just silly for anything but the simplest servers.

from docker-openssh-server.

linuxmaniac avatar linuxmaniac commented on July 26, 2024

# custom port
if [[ -n "${LISTEN_PORT}" ]]; then
sed -i "s/^#Port [[:digit:]]\+/Port ${LISTEN_PORT}"/ /etc/ssh/sshd_config
sed -i "s/^Port [[:digit:]]\+/Port ${LISTEN_PORT}"/ /etc/ssh/sshd_config
echo "sshd is listening on port ${LISTEN_PORT}"
else
sed -i "s/^#Port [[:digit:]]\+/Port 2222"/ /etc/ssh/sshd_config
sed -i "s/^Port [[:digit:]]\+/Port 2222"/ /etc/ssh/sshd_config
echo "sshd is listening on port 2222"
fi

It seems you can just use LISTEN_PORT

from docker-openssh-server.

yoelvd avatar yoelvd commented on July 26, 2024

Ok I added LISTEN_PORT as a new environment variable for my docker-compose and it works! And yet, the corresponding image documentation isn't reflecting this change. I had to come here to learn this. Thanks @linuxmaniac

from docker-openssh-server.

linuxmaniac avatar linuxmaniac commented on July 26, 2024

@yoelvd please provide a PR with the changes in doc that you would like to see as a new user of the image. That would be great

from docker-openssh-server.

thespad avatar thespad commented on July 26, 2024

It's not documented because we don't support it.

95% of the use cases that require it are scenarios we don't support in the first place because they are entirely ephemeral and don't provide any means of mounting a persistent /config (and thus editing sshd_config to change the listen port). Including it in the readme would imply support that we're not willing to provide.

Rather than not provide any option at all, we opted to provide an undocumented route that those with the wherewithal to understand can make use of, on the basis that if you can figure that out you're probably not going to be coming back to us for basic support for your weird setup.

(And yes, we were originally hard-coding the listen port in the sshd run command which was overriding the value(s) in sshd_config but that's no longer the case).

from docker-openssh-server.

drizuid avatar drizuid commented on July 26, 2024

closing as we have provided an explanation and our support stance. We will not entertain documenting it.

from docker-openssh-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.