• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] install ssh service to running container
#1
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
  Reply
#2
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
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#3
Okey thank you, that should help :-)

**its working Smile
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  TOSILOCK for CONTAINER COswald 3 2,192 July-13th-2021, 11:32 AM
Last Post: Armin@netPI
  Access to RTC from my own container application tad 1 3,525 March-19th-2021, 02:58 PM
Last Post: Armin@netPI
  [SOLVED] Starting services/commands/scripts at startup of a container Jonas.Sellmann@outlook.de 9 6,046 March-9th-2021, 08:47 AM
Last Post: WalterSchaefer
  docker.service start failed EUROKEY 13 9,178 January-17th-2021, 07:52 PM
Last Post: Armin@netPI
  OpenVPN container Armin@netPI 0 1,618 January-3rd-2021, 12:13 PM
Last Post: Armin@netPI
  operating Console of a container on netPI connected to Wi-Fi tethering tad 3 2,620 December-3rd-2020, 12:32 PM
Last Post: tad
  NIOT-E-NPIX-4DI4DO with netpi-netx container WalterSchaefer 3 6,488 November-25th-2020, 01:06 PM
Last Post: zen89
  NPIX-4DI4DO and NetPi-Nodered container issues alhammi 4 7,605 November-16th-2020, 01:35 PM
Last Post: alhammi
  Get host MAC via REST API inside container bschandra 4 3,654 November-16th-2020, 09:26 AM
Last Post: bschandra
  Exporting and importing container images Armin@netPI 3 3,067 May-20th-2020, 11:24 AM
Last Post: COswald

Forum Jump:


Users browsing this thread: 1 Guest(s)