mirror of
https://github.com/bigbeartechworld/big-bear-scripts.git
synced 2026-07-31 01:18:16 -04:00
Add enable SSH on a pve lxc
This commit is contained in:
16
enable-ssh-on-pve-lxc/README.md
Normal file
16
enable-ssh-on-pve-lxc/README.md
Normal file
@@ -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)"
|
||||
```
|
||||
21
enable-ssh-on-pve-lxc/run.sh
Normal file
21
enable-ssh-on-pve-lxc/run.sh
Normal file
@@ -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!"
|
||||
Reference in New Issue
Block a user