0

I am trying to secure my VNC session using OpenSSH(ssshd) and Putty(client)(everything is on windows)

First I establish a tunnel using putty and then log into my server PC using username and password

Second, I turn on my VNC client and server on the respective sides.

The problem i am facing is that my vnc session is not going through the tunnel.

1 - Following is the command which i am using to establish the tunnel putty.exe -ssh w21821@10.31.128.23 -L 5900:10.31.128.23:5900

2 - Following is my SSHD_config file ,

**

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.
Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
# The default requires explicit activation of protocol 1
Protocol 2
# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024
# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
LogLevel DEBUG3
# Authentication:
#LoginGraceTime 2m
PermitRootLogin yes
StrictModes no
#MaxAuthTries 6
#MaxSessions 10
#RSAAuthentication yes
#PubkeyAuthentication yes
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile  .ssh/authorized_keys
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes
# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
PermitEmptyPasswords no
# Change to no to disable s/key passwords
ChallengeResponseAuthentication yes
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
# Set this to 'yes' to enable PAM authentication, account processing, 
# and session processing. If this is enabled, PAM authentication will 
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
#UsePAM no
AllowAgentForwarding yes
AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
PermitTunnel yes
#ChrootDirectory none
# no default banner path
#Banner none
# override default of no subsystems
Subsystem   sftp    sftp-server.exe
# Example of overriding settings on a per-user basis
#Match User anoncvs
#   X11Forwarding no
#   AllowTcpForwarding no
#   ForceCommand cvs server
# PubkeyAcceptedKeyTypes ssh-ed25519*
hostkeyagent \\.\pipe\openssh-ssh-agent

**

When I give this command ond on the client side, netstat -aon | find ":5900" I get this

netstat

In this picture, first is the example of vnc session through the tunnel, whereas the others are not going through the tunnel.

I got the 1st output only once, since then the same output appears again and again.

Can someone guide me on this??

Thanks in advance!!

  • to confim, when you invoke vnc, you are pointing it to 127.0.0.1:5900, right? – Frank Thomas Dec 5 '17 at 13:56
  • @FrankThomas , First i was giving the address as localhost:0 , which is equivalent to 127.0.0.1:5900 – Verma Dec 5 '17 at 14:13
  • From your netstat, the tunnel endpoint is LISTENING on 127.0.0.1, so your connections have to be directed to it. – Frank Thomas Dec 5 '17 at 14:35
  • wait, from your tunnel command, both IP addresses and port numbers are the same. have you tried setting your tunnel to use a different port (the -L argument) like 7934? – Frank Thomas Dec 5 '17 at 16:58
  • I tried , putty.exe -ssh w21821@10.31.128.23 -L 7934:10.31.128.23:5900 , But its not going through the tunnel. – Verma Dec 6 '17 at 8:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.