add ssh-keygen.sh and ssh-enhancer.sh
This commit is contained in:
parent
30c2c1055f
commit
083ef2de53
22
shell/ssh-enhancer.sh
Normal file
22
shell/ssh-enhancer.sh
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
echo "Usage: sudo bash $0 <port>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
port=$1
|
||||||
|
|
||||||
|
# Check if the port is a number
|
||||||
|
if ! [[ "$port" =~ ^[0-9]+$ ]]; then
|
||||||
|
echo "Error: Port must be a number."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create a new sshd_config file with 99- prefix in /etc/ssh/sshd_config.d/ directory
|
||||||
|
echo -e "Port $port\nPasswordAuthentication no" | sudo tee /etc/ssh/sshd_config.d/99-custom_ssh_port.conf > /dev/null
|
||||||
|
|
||||||
|
# Restart SSH service to apply changes
|
||||||
|
sudo systemctl restart sshd
|
||||||
|
|
||||||
|
echo "SSH port changed to $port and password authentication disabled."
|
1
shell/ssh-keygen.sh
Normal file
1
shell/ssh-keygen.sh
Normal file
@ -0,0 +1 @@
|
|||||||
|
ssh-keygen -t rsa -b 4096
|
Loading…
Reference in New Issue
Block a user