HA-EasyComputerManager/.github/wiki/script-auto-config-linux.sh
Mathieu Broillet c292bcd226
Some checks failed
Validate with hassfest / validate (push) Failing after 2s
HACS Action / HACS Action (push) Failing after 5s
move docs to wiki and created auto scripts for configuration
2023-12-31 14:15:49 +01:00

24 lines
781 B
Bash

#!/bin/bash
# Enable SSH Server
if command -v systemctl &> /dev/null; then
sudo systemctl enable --now sshd
else
echo "Systemctl not found. Please enable SSH manually."
fi
# Configure sudoers
echo "Configuring sudoers..."
echo -e "\n# Allow your user to execute specific commands without a password" | sudo tee -a /etc/sudoers
echo "$(whoami) ALL=(ALL) NOPASSWD: /sbin/shutdown, /sbin/init, /usr/bin/systemctl, /usr/sbin/pm-suspend, /usr/bin/awk, /usr/sbin/grub-reboot, /usr/sbin/grub2-reboot" | sudo tee -a /etc/sudoers
# Firewall Configuration
if command -v ufw &> /dev/null; then
echo "Configuring firewall..."
sudo ufw allow 22
else
echo "UFW not found. Please configure the firewall manually."
fi
echo "You can now add your computer to HomeAssistant."