termux-connecting 1.1.28 → 1.1.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/termux-connect-pc +14 -4
- package/package.json +1 -1
package/bin/termux-connect-pc
CHANGED
|
@@ -164,7 +164,7 @@ cmd_connection() {
|
|
|
164
164
|
local connected=false
|
|
165
165
|
|
|
166
166
|
# Key-based
|
|
167
|
-
if run_timeout 10 ssh -o ConnectTimeout=5 -o BatchMode=yes -p "$SSH_PORT" "${SSH_USER}@${SSH_HOST}" "echo connected"; then
|
|
167
|
+
if run_timeout 10 ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=5 -o BatchMode=yes -p "$SSH_PORT" "${SSH_USER}@${SSH_HOST}" "echo connected"; then
|
|
168
168
|
info "Koneksi berhasil (key-based)"
|
|
169
169
|
connected=true
|
|
170
170
|
# Password via sshpass
|
|
@@ -184,7 +184,7 @@ cmd_connection() {
|
|
|
184
184
|
echo " ssh -p ${SSH_PORT} ${SSH_USER}@${SSH_HOST}"
|
|
185
185
|
echo ""
|
|
186
186
|
echo -n " ➤ Setelah berhasil, tekan enter untuk lanjut..."; read -r
|
|
187
|
-
if run_timeout 10 ssh -o ConnectTimeout=5 -o BatchMode=yes -p "$SSH_PORT" "${SSH_USER}@${SSH_HOST}" "echo connected"; then
|
|
187
|
+
if run_timeout 10 ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=5 -o BatchMode=yes -p "$SSH_PORT" "${SSH_USER}@${SSH_HOST}" "echo connected"; then
|
|
188
188
|
connected=true
|
|
189
189
|
fi
|
|
190
190
|
fi
|
|
@@ -222,11 +222,21 @@ cmd_connection() {
|
|
|
222
222
|
if [ -f "$SSH_KEY" ]; then
|
|
223
223
|
echo ""
|
|
224
224
|
echo " Meng-copy public key ke HP..."
|
|
225
|
-
|
|
225
|
+
local copy_ok=false
|
|
226
|
+
if command -v sshpass >/dev/null && [ -n "$pass" ]; then
|
|
227
|
+
if run_timeout 15 sshpass -p "$pass" ssh-copy-id -i "$SSH_KEY" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=10 -p "$SSH_PORT" "${SSH_USER}@${SSH_HOST}"; then
|
|
228
|
+
copy_ok=true
|
|
229
|
+
fi
|
|
230
|
+
else
|
|
231
|
+
if run_timeout 15 ssh-copy-id -i "$SSH_KEY" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=10 -p "$SSH_PORT" "${SSH_USER}@${SSH_HOST}"; then
|
|
232
|
+
copy_ok=true
|
|
233
|
+
fi
|
|
234
|
+
fi
|
|
235
|
+
if $copy_ok; then
|
|
226
236
|
info "Public key berhasil di-copy ke HP"
|
|
227
237
|
else
|
|
228
238
|
warn "Gagal copy otomatis. Copy manual:"
|
|
229
|
-
echo " ssh-copy-id -p ${SSH_PORT} ${SSH_USER}@${SSH_HOST}"
|
|
239
|
+
echo " ssh-copy-id -i ${SSH_KEY} -p ${SSH_PORT} ${SSH_USER}@${SSH_HOST}"
|
|
230
240
|
fi
|
|
231
241
|
fi
|
|
232
242
|
|