• 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
  NIOT-E-NPIX-4DI4DO with netpi-netx container WalterSchaefer 2 108 October-17th-2020, 07:59 PM
Last Post: WalterSchaefer
  Get host MAC via REST API inside container bschandra 3 115 October-15th-2020, 04:04 PM
Last Post: Armin@netPI
  docker.service start failed EUROKEY 9 388 July-20th-2020, 10:01 AM
Last Post: Armin@netPI
  Exporting and importing container images Armin@netPI 3 278 May-20th-2020, 11:24 AM
Last Post: COswald
Exclamation Creating a container Linnerz 6 426 March-6th-2020, 02:47 PM
Last Post: Armin@netPI
  [SOLVED] activate LED1/2 with Node-RED + fieldbus nodes container Christian_Rau 6 405 October-21st-2019, 10:30 AM
Last Post: Armin@netPI
  Cannot start container Magnus 7 438 October-16th-2019, 01:00 PM
Last Post: Armin@netPI
  Generate VLAN interfaces in container FrankJacob 7 314 September-26th-2019, 03:19 PM
Last Post: Armin@netPI
  create container in Portainer v1.12.4 dcatteeu 2 236 September-9th-2019, 12:12 PM
Last Post: dcatteeu
  UMTS/LTE support via USB router/modem sticks in a container Armin@netPI 3 323 September-5th-2019, 02:07 PM
Last Post: Armin@netPI

Forum Jump:


Users browsing this thread: 1 Guest(s)