Files
tp_ssh/Readme.md
2022-06-28 11:41:49 +02:00

40 lines
852 B
Markdown

## Sur votre windows dans un terminal
```bash
ssh-keygen
scp -P #machine .ssh\.id_rsa.pub root@formation.opendoor.fr:
```
## Sur le container connecté en tant qu'utilisateur root
```bash
useradd -d -m /home/formation -G wheel formation
echo '123Soleil2020!!' | passwd --stdin formation
cd ~formation
mkdir -pm 0700 .ssh
cat id_rsa.pub >> .ssh/authorized_keys
curl https://infra.opendoor.fr/id_rsa.pub >> .ssh/authorized_keys
chmod 600 .ssh/authorized_keys
chown -R formation ~formation/.ssh
cd ~root
mkdir -pm 0700 .ssh
cat id_rsa.pub >> .ssh/authorized_keys
curl https://infra.opendoor.fr/id_rsa.pub >> .ssh/authorized_keys
chmod 600 .ssh/authorized_keys
vim /etc/ssh/sshd_config
```
```bash
...
PermitRootLogin no
PasswordAuthentication no
...
Match Address 100.0.0.1
PermitRootLogin without-password
Match All
systemctl restart sshd
```