From ed2495c31251aa0ec92d79472a5999df0164be7e Mon Sep 17 00:00:00 2001 From: Christopher Date: Sat, 23 Sep 2023 10:55:31 -0500 Subject: [PATCH] Add enable SSH on a pve lxc --- enable-ssh-on-pve-lxc/README.md | 16 ++++++++++++++++ enable-ssh-on-pve-lxc/run.sh | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 enable-ssh-on-pve-lxc/README.md create mode 100644 enable-ssh-on-pve-lxc/run.sh diff --git a/enable-ssh-on-pve-lxc/README.md b/enable-ssh-on-pve-lxc/README.md new file mode 100644 index 0000000..5c2b124 --- /dev/null +++ b/enable-ssh-on-pve-lxc/README.md @@ -0,0 +1,16 @@ +# SSH Root Login Enabler Script + +## Overview + +This shell script is designed to set up a root password and enable SSH root login on a Linux system. `Please note that enabling SSH root login can be a security risk. Use this script only if you understand the implications.` + +## Prerequisites + +- The script must be run on a Linux system. +- The script must be run as the root user. + +## How to use? + +```bash +bash -c "$(wget -qLO - https://raw.githubusercontent.com/bigbeartechworld/big-bear-scripts/master/enable-ssh-on-pve-lxc/disable_dns_service.sh)" +``` diff --git a/enable-ssh-on-pve-lxc/run.sh b/enable-ssh-on-pve-lxc/run.sh new file mode 100644 index 0000000..be9087d --- /dev/null +++ b/enable-ssh-on-pve-lxc/run.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Check for root privileges +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root." + exit 1 +fi + +# Set the root password +echo "Setting up root password..." +passwd root + +# Enable SSH root login +echo "Enabling SSH for root..." +sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config + +# Restart the SSH service +echo "Restarting SSH service..." +systemctl restart sshd + +echo "Done!"