Spaces:
Paused
Paused
BinaryONe
commited on
Commit
·
96d7379
1
Parent(s):
d00dfc0
Changes
Browse files
start.sh
CHANGED
|
@@ -65,6 +65,13 @@ add_admin_authorized_keys() {
|
|
| 65 |
fi
|
| 66 |
}
|
| 67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
# Function to activate virtual environment
|
| 69 |
activate_virtual_env() {
|
| 70 |
if [ -d "/app/WebSSHEnv" ]; then
|
|
@@ -133,6 +140,7 @@ start_ssh_service
|
|
| 133 |
fix_admin_permissions
|
| 134 |
generate_admin_ssh_keys
|
| 135 |
add_admin_authorized_keys
|
|
|
|
| 136 |
netstat -tuln
|
| 137 |
#Test if admin's credentials are correct
|
| 138 |
|
|
|
|
| 65 |
fi
|
| 66 |
}
|
| 67 |
|
| 68 |
+
# Function to add SSH private key to the SSH agent
|
| 69 |
+
add_ssh_key_to_agent() {
|
| 70 |
+
if ! ssh-add -l | grep -q '/home/admin/.ssh/id_rsa'; then
|
| 71 |
+
echo "* Adding SSH private key to the SSH agent *"
|
| 72 |
+
ssh-add /home/admin/.ssh/id_rsa || { echo "Failed to add SSH private key to agent"; exit 1; }
|
| 73 |
+
fi
|
| 74 |
+
}
|
| 75 |
# Function to activate virtual environment
|
| 76 |
activate_virtual_env() {
|
| 77 |
if [ -d "/app/WebSSHEnv" ]; then
|
|
|
|
| 140 |
fix_admin_permissions
|
| 141 |
generate_admin_ssh_keys
|
| 142 |
add_admin_authorized_keys
|
| 143 |
+
add_ssh_key_to_agent
|
| 144 |
netstat -tuln
|
| 145 |
#Test if admin's credentials are correct
|
| 146 |
|