-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathssh_manager.sh
More file actions
44 lines (36 loc) · 881 Bytes
/
ssh_manager.sh
File metadata and controls
44 lines (36 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# SSH Manager Script
echo "SSH Manager Script"
echo "1. Connect to a server"
echo "2. Copy SSH key to a server"
echo "3. Test SSH connection"
echo "4. Exit"
read -p "Select an option (1-4): " choice
case $choice in
1)
read -p "Enter username: " username
read -p "Enter server IP or hostname: " server
ssh $username@$server
;;
2)
read -p "Enter username: " username
read -p "Enter server IP or hostname: " server
ssh-copy-id $username@$server
echo "SSH key copied successfully."
;;
3)
read -p "Enter server IP or hostname: " server
if ssh -q -o "BatchMode=yes" $server "exit"; then
echo "SSH connection successful!"
else
echo "SSH connection failed."
fi
;;
4)
echo "Exiting..."
exit 0
;;
*)
echo "Invalid choice. Please select a number between 1 and 4."
;;
esac