Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
ssh_scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sofiane Bendoukha
ssh_scripts
Commits
aa6ec008
Commit
aa6ec008
authored
5 years ago
by
Mathis Rosenhauer
Browse files
Options
Downloads
Patches
Plain Diff
start-vnc: use random local port because of WSL
parent
7f5c3702
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
start-vnc
+13
-8
13 additions, 8 deletions
start-vnc
with
13 additions
and
8 deletions
start-vnc
+
13
−
8
View file @
aa6ec008
...
...
@@ -288,13 +288,18 @@ main () {
echo
"Vncserver started on node
${
vnc_host
}
.dkrz.de display
\
:
${
vnc_display
}
."
local
vnc_port
=
$((
5900
+
${
vnc_display
}))
ssh
-o
ForwardX11
=
no
\
-o
StrictHostKeyChecking
=
accept-new
\
-L
"
${
vnc_port
}
:localhost:
${
vnc_port
}
"
\
-Nf
\
"
${
SVNC_USERNAME
}
@
${
vnc_host
}
.dkrz.de"
;
local
vnc_port_local
=
$((
5900
+
RANDOM
%
100
))
# WSL doesn't seem to detect used ports so randomize
# local port to reduce risk of masking.
local
vnc_port_remote
=
$((
5900
+
vnc_display
))
while
!
ssh
-o
ForwardX11
=
no
\
-o
StrictHostKeyChecking
=
accept-new
\
-L
"
${
vnc_port_local
}
:localhost:
${
vnc_port_remote
}
"
\
-Nf
\
"
${
SVNC_USERNAME
}
@
${
vnc_host
}
.dkrz.de"
;
do
vnc_port_local
=
$((
5900
+
RANDOM
%
100
))
echo
"Trying local port
${
vnc_port_local
}
."
done
local
client_options
client_options
=
"
${
SVNC_CLIENT_OPTIONS
:-}
"
if
[[
${
SVNC_PASSWORD
}
=
"true"
]]
;
then
...
...
@@ -303,7 +308,7 @@ main () {
client_options+
=
" -passwd vnc_passwd"
fi
echo
"Connecting vncviewer to
${
vnc_host
}
.dkrz.de"
"
${
SVNC_CLIENT
}
"
${
client_options
}
:
$
{
vnc_
display
}
"
${
SVNC_CLIENT
}
"
${
client_options
}
:
$
((
vnc_
port_local
-
5900
))
}
main
"
$@
"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment