クライアント
ssh-keygen -q -f $HOME/.ssh/id_rsa -P ''
cat $HOME/.ssh/id_rsa.pub
サーバー id_rsa.pub
をauthorized_keys
にコピペ
echo ssh $USER@$(curl -sL domains.google.com/checkip)
mkdir -p $HOME/.ssh
chmod 0700 $HOME/.ssh
touch $HOME/.ssh/authorized_keys
chmod 0600 $HOME/.ssh/authorized_keys
vim $HOME/.ssh/authorized_keys
rootでログインする場合
echo PermitRootLogin yes >> /etc/ssh/sshd_config
systemctl reload sshd
ユーザーを追加する場合( Debian )
USERNAME=myuser
sudo useradd -m -p '' $USERNAME
sudo usermod -aG sudo $USERNAME
su - $USERNAME
echo ssh $USER@$(curl -sL domains.google.com/checkip)
mkdir -p $HOME/.ssh
chmod 0700 $HOME/.ssh
touch $HOME/.ssh/authorized_keys
chmod 0600 $HOME/.ssh/authorized_keys
vim $HOME/.ssh/authorized_keys
ユーザーを追加する場合( Rocky Linux )
USERNAME=myuser
sudo useradd -m -p '' $USERNAME
sudo usermod -aG wheel $USERNAME
su - $USERNAME
echo ssh $USER@$(curl -sL domains.google.com/checkip)
mkdir -p $HOME/.ssh
chmod 0700 $HOME/.ssh
touch $HOME/.ssh/authorized_keys
chmod 0600 $HOME/.ssh/authorized_keys
vim $HOME/.ssh/authorized_keys