TurboVNC / turbovnc

Main TurboVNC repository
https://TurboVNC.org
GNU General Public License v2.0
747 stars 137 forks source link

Username is always ignored in favor of logged in username #330

Closed jefferai closed 2 years ago

jefferai commented 2 years ago

Hi there and thanks for TurboVNC!

When using the TurboVNC viewer on Windows, regardless of the setting in Options/Security for "username" and "Send local username", it always sends a capitalized version of my local username Jeff. So if I uncheck that option and type in jeff it still tries to authenticate as Jeff. If I change the value in the username field entirely, e.g. to admin, and leave Send local username unchecked, it still sends Jeff. As a result I can't connect to anything :-/

If I put jeff@<my host> when connecting it wants to launch a session list; since the server isn't TurboVNC, this fails.

jefferai commented 2 years ago

I should add: this is with 3.0, which is the only version I've tried.

dcommander commented 2 years ago

You need to set the LocalUsernameLC parameter. This can be accomplished by editing the "TurboVNC Viewer" Start Menu shortcut and changing "Target:" from "C:\Program Files\TurboVNC\vncviewerw.bat" to "C:\Program Files\TurboVNC\vncviewerw.bat" -localusernamelc. If you're a command line user, then you can simply pass that parameter to "C:\Program Files\TurboVNC\vncviewer.bat".

jefferai commented 2 years ago

That worked, but I'm still confused why it was using the local username when the option wasn't checked. Thanks for your help!

dcommander commented 2 years ago

Yeah, I was just about to reply that that is unexpected behavior. What type of VNC server are you connecting to?

jefferai commented 2 years ago

Connecting to TigerVNC. But adding that option fixed the problem so it doesn't seem like it's a server side issue...

dcommander commented 2 years ago

I agree. That's why I would like as much information as possible, so I can attempt to reproduce the issue. Which version of TigerVNC? Is the server using default options?

jefferai commented 2 years ago

Sorry for the delay, I've been out of town.

Server is using TigerVNC from Arch, specifically 1.12.0-3.

I've only modified the users file; I haven't modified the defaults or mandatory files. In my home dir I've only set session and alwaysshared.

dcommander commented 2 years ago

That's odd, because TigerVNC generally isn't configured to support user/password authentication by default. I just tested the TurboVNC 3.0 Viewer with both the TigerVNC Server configured to support user/password authentication as well as the TurboVNC Server, which supports user/password authentication by default. I could not reproduce any issues. Can you provide more details regarding how you are setting the username in the TurboVNC Viewer? What does the authentication dialog look like when you connect?

jefferai commented 2 years ago

I installed TigerVNC server from the Arch package, I edited /etc/tigervnc/users to map a display to my username, and then as my user ran vncpasswd to set a password. Maybe there are some defaults in the Arch package.

I figured out part of it. If I use 192.168.10.11:0, explicitly specifying a display, then everything works because it just asks for my VNC password. If I don't explicitly specify a display, then it defaults to SSHing in and this is where I'm seeing that username behavior, where the username is always Jeff even if I explicitly provide jeff in the box on the Security page.

dcommander commented 2 years ago

That explains the issue. When you don’t specify a display, the viewer tries to use the TurboVNC Session Manager, which is subject to the SSHUser parameter rather than the Username parameter (but the TurboVNC Session Manager requires the TurboVNC Server, so it isn’t relevant to your workflow.) Username and SendLocalUsername only affect VeNCrypt user/password authentication.

jefferai commented 2 years ago

Awesome, thanks. I think I didn't realize the :0 change I had made -- I had (naively) assumed that leaving it off would be equivalent to :0 an at some point when trying things out I must have changed it.