This repository uses modular bash scripts to set up SSH server on Kaggle with password authentication. Here’s what each script does:
install_ssh_server.shPurpose: Sets up SSH server with password authentication
Usage:
bash install_ssh_server.sh [PASSWORD]
Parameters:
PASSWORD (optional): Your desired SSH password. Default is “kaggle” if not provided.What it does:
Example:
# In Kaggle notebook
ssh_password = "my_secure_password"
!bash install_ssh_server.sh $ssh_password
add_ngrok_token.shPurpose: Adds your ngrok authentication token
Usage:
bash add_ngrok_token.sh YOUR_NGROK_TOKEN
Parameters:
YOUR_NGROK_TOKEN: Your ngrok authentication token from https://dashboard.ngrok.com/authWhat it does:
Example:
# In Kaggle notebook
!bash add_ngrok_token.sh YOUR_NGROK_TOKEN
run_ssh_server.shPurpose: Starts ngrok tunnel to expose SSH server
Usage:
bash run_ssh_server.sh
Parameters: None
What it does:
Output:
Forwarding: tcp://0.tcp.ap.ngrok.io:12345 -> localhost:22
Use the hostname (0.tcp.ap.ngrok.io) and port (12345) to connect via VS Code.
Example:
# In Kaggle notebook
!bash run_ssh_server.sh
Edit the PASSWORD line near the top of install_ssh_server.sh:
PASSWORD=${1:-"your_new_default_password"}
[!NOTE] Recent ngrok versions print
Flag --region has been deprecated, ngrok automatically chooses the region with lowest latency. The flag is still accepted, but you normally no longer need to set it.
To pin a region anyway, edit the ngrok line in run_ssh_server.sh:
ngrok tcp 22 --region us # or eu, ap, au, sa, jp, in
In install_ssh_server.sh, add your line alongside the other sshd_config writes —
anywhere above sudo service ssh restart:
echo "YourCustomConfig yes" | sudo tee -a /etc/ssh/sshd_config
[!WARNING] Use
| sudo tee -a, notsudo echo ... >>. Withsudo echo, the redirect is performed by your own shell beforesudoruns, so it fails on a root-owned file. The script itself already uses theteeform.