Hilscher Community Forum
[SOLVED] install ssh service to running container - Printable Version

+- Hilscher Community Forum (https://forum.hilscher.com)
+-- Forum: netPI 3 - Docker featuring Industrial Raspberry Pi 3 platform (https://forum.hilscher.com/forum-1.html)
+--- Forum: Software (https://forum.hilscher.com/forum-5.html)
+--- Thread: [SOLVED] install ssh service to running container (/thread-326.html)



[SOLVED] install ssh service to running container - paubau - October-12th-2018

hello, 
is there a way to install an ssh service to a running container?
I tried to add 
Quote:        apt-get install -y git openssh-server \
   && echo
'root:root' | chpasswd \
   && sed -i
's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
   && sed
's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd \
   && mkdir /var/run/sshd \

manually to the installed nodered-fieldbus container and didnt get any errors 
but when trying to connect via putty, it says connection denied..
how to add ssh server correctly?

**i also published the port 22 when setting up the container


RE: install ssh service to running container - Armin@netPI - October-12th-2018

Well the code you mentioned in your post is just half of the work. The code installs everything needed for SSH. But you have to start the SSH server in your container

If you look for example to our Raspbian container here you will detect your code section there as well which is fine.

But there is also the start script entrypoint.sh. And in this start script the SSH server is started finally before the script vanishes in an endless loop.

Here is the code you find in there and you need to add to you start script as well:

echo "starting ssh ..."
sudo /etc/init.d/ssh start

Regards
Armin


RE: install ssh service to running container - paubau - October-12th-2018

Okey thank you, that should help :-)

**its working Smile