-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce3eddd
commit 4aeaf21
Showing
5 changed files
with
91 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@echo off | ||
:: Check for Administrator privileges | ||
net session >nul 2>&1 | ||
if %errorlevel% neq 0 ( | ||
echo Requesting administrator privileges... | ||
powershell Start-Process "%~0" -Verb RunAs | ||
exit /b | ||
) | ||
|
||
:: Check if SSHD service exists | ||
sc query sshd >nul 2>&1 | ||
if %errorlevel% neq 0 ( | ||
echo The SSHD service is not installed on this system. | ||
exit /b | ||
) | ||
|
||
:: Check if SSHD is running | ||
sc query sshd | findstr /I "RUNNING" | ||
if %errorlevel% equ 0 ( | ||
echo SSHD service is already running. | ||
) else ( | ||
echo Starting SSHD service... | ||
net start sshd | ||
if %errorlevel% equ 0 ( | ||
echo SSHD service started successfully. | ||
) else ( | ||
echo Failed to start SSHD service. | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
# Function to check if the script is being run as root | ||
check_root() { | ||
if [ "$(id -u)" -ne 0 ]; then | ||
echo "This script must be run as root. Please try again with sudo or as root." | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Check if running as root | ||
check_root | ||
|
||
# Check if the SSHD service is installed | ||
if ! systemctl list-units --type=service --all | grep -q 'sshd.service'; then | ||
echo "The SSHD service is not installed on this system." | ||
exit 1 | ||
fi | ||
|
||
# Check if SSHD is running | ||
if systemctl is-active --quiet sshd; then | ||
echo "SSHD service is already running." | ||
else | ||
echo "Starting SSHD service..." | ||
systemctl start sshd | ||
if [ $? -eq 0 ]; then | ||
echo "SSHD service started successfully." | ||
else | ||
echo "Failed to start SSHD service." | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters