ESXiのSSHを起動時に有効化
ESXiの再起動時に自動でSSHを有効化する.
Enable the SSH shell permanently in VMWare ESXi 6.7.0 and above
以下の設定ファイルを /etc/rc.local.d/local.sh
の exit 0
よりも前に追記する.
if [ "$(cat /etc/rc.local.d/local.sh | grep "vim-cmd hostsvc/enable_ssh" | wc -l)" -eq "0" ]
then
sed -i '/exit 0/d' /etc/rc.local.d/local.sh
echo "vim-cmd hostsvc/enable_ssh" >> /etc/rc.local.d/local.sh && \
echo "exit 0" >> /etc/rc.local.d/local.sh
if [ "$(cat /etc/rc.local.d/local.sh | \
grep "vim-cmd hostsvc/enable_ssh" | wc -l)" -eq "1" ]
then
echo "---------------------------------------"
echo "- Automatic SSH startup was installed -"
echo "---------------------------------------"
fi
else
echo "-----------------------------------------------"
echo "- Automatic SSH startup is already configured -"
echo "-----------------------------------------------"
fi