Create a ssh tunnel after network is ready on Debian/Raspberry Pi
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 48/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- debian, raspberry-pi, shell
- Domain
- documentation, networking, operating-systems
Research direction
Start by checking how this repository organizes programming tips, then use the issue's /etc/rc.local example and rc-local systemctl commands as the source material. Done means adding a clear tip explaining how to create the SSH tunnel after networking is ready on Debian or Raspberry Pi, including the required executable and service setup.
Written by the indexing model from the issue text.
Description
A ssh tunnel could be created in /etc/rc.local. As following:
vim /etc/rc.local
timeout=5
ssh -p 22 -o BatchMode=yes -o ConnectTimeout=3 -i /data/david/xxx.pem -fCNR 7280:localhost:22 root@101.20.5.6
while test $? -gt 0
do
sleep 3 # highly recommended - if it's in your local network, it can try an awful lot pretty quick...
echo "Trying again..."
ssh -p 22 -o BatchMode=yes -o ConnectTimeout=3 -i /data/david/xxx.pem -fCNR 7280:localhost:22 root@101.20.5.6
TIMEOUT=$((TIMEOUT-1))
if [ $TIMEOUT -eq 0 ]; then
echo "timed out"
# error time out
exit 1
fi
done
sleep 3
Here the -o BatchMode=yes means the SSH connection will fail immediately if the key is rejected, instead of failing back to a password prompt. The ConnectionTimeout the timeout for ssh command, so it would not wait for a long time.
Note that for Debian 9/10/11, rc.local would not run by default.
You need to make the script executable, and also enable the service.
chmod +x /etc/rc.local
systemctl start rc-local
systemctl enable rc-local
- Dominant language
- Python
- Stars
- 5
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from davideuler/programming-tips
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
-
Difficulty 1/5 Under an hour Newbie friendliness 35/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
-
build milvus on Mac Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
All issues in davideuler/programming-tips
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
syfoud/Simulated_Scepter#172 ·
-
A cancelled tests run makes the coverage comment workflow fail and reports it as a red check on main Openarea: ci bug perceived difficulty: 3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Nitjsefnie-Harness-Commons/daedalus#921 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ClickHouse/clickhouse-connect#1057 ·