Ubuntu Server su Docker

  1. apt update
    apt install -y openssh-server
    service ssh start
    service ssh status

Se voglio creare un nuovo utente nel sistema :

adduser mario

In base alle porte che ho esposto :

Esempio 2222:22

ssh mario@localhost -p 2222

Se voglio collegarmi con l'utente di root :

sed -i 's/^#?PasswordAuthentication./PasswordAuthentication yes/' /etc/ssh/sshd_config
sed -i 's/^#?PermitRootLogin./PermitRootLogin yes/' /etc/ssh/sshd_config

Se mi serve il client per collegarmi in ssh :

apt install openssh-client -y

#!/bin/bash
echo "Installing ssh server on Machine"
apt update
apt install openssh-server -y
service ssh start 
echo "Enable root access"
sed -i 's/^#?PasswordAuthentication./PasswordAuthentication yes/' /etc/ssh/sshd_config
sed -i 's/^#?PermitRootLogin./PermitRootLogin yes/' /etc/ssh/sshd_config

Last updated