#!/usr/bin/bash

apt install -y curl

#ssh
#cat ~/ab.pub  >> ~/.ssh/authorized_keys
#cat /home/its/ab.pub  >> ~/.ssh/authorized_keys
mkdir -p /root/.ssh
grep -qF "adalt@host-113" "~/.ssh/authorized_keys" || \
	echo 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJXyNC7kn4rfESNufooU5If8nLiTvJGJa6QlpnqRfa0I adalt@host-113' >> ~/.ssh/authorized_keys
#curl its.alexunderboots.ru/ab.pub >> ~/.ssh/authorized_keys

echo 'AuthorizedKeysFile      .ssh/authorized_keys .ssh/authorized_keys2' > /etc/ssh/sshd_config.d/its.conf
echo 'X11Forwarding yes' >> /etc/ssh/sshd_config.d/its.conf
echo 'X11DisplayOffset 10' >> /etc/ssh/sshd_config.d/its.conf
echo 'X11UseLocalhost no' >> /etc/ssh/sshd_config.d/its.conf
echo '#PasswordAuthentication      no' >> /etc/ssh/sshd_config.d/its.conf
chmod 600 authorized_keys
chmod 770 /root/.ssh
chmod 770 /root

systemctl restart sshd
