If you run Claude Code on a remote server and connect to it through PuTTY, you'll hit a wall the first time it asks you to authenticate. Claude Code prints a login URL and expects you to open it in a browser, but you can't seem to copy the URL out of the terminal. Dragging across it does nothing. Once you're logged in, you also need to paste a code back into the terminal, which fails in the same way.
This guide explains why it happens and how to get through the login in a couple of seconds once you know the trick.
Why You Can't Copy the Login URL
Two things are working against you here, and neither is obvious.
First, PuTTY doesn't copy with Ctrl+C the way most Windows programs do. Inside a terminal, Ctrl+C sends an interrupt signal to whatever is running. PuTTY instead copies text the instant you select it with the mouse, so there's no copy shortcut to press at all.
Second, Claude Code is an interactive terminal application, and it switches on mouse reporting. That means your click and drag gets handed to Claude Code rather than to PuTTY, so PuTTY never makes a selection and nothing reaches your clipboard. This is why plain dragging looks like it does nothing.
Logging In Step by Step
The trick is to hold Shift while you select or paste. Holding Shift tells PuTTY to ignore the application and do its own local clipboard action instead.
Start Claude Code in your terminal:
claude
It prints a login URL, usually wrapped across two or three lines. From there:
- Select the URL. Hold Shift and drag across the URL to select it. The moment it's selected, it's on your Windows clipboard. If the URL wraps across several rows, hold Shift and triple-click it to grab the whole line at once.
- Open it in a browser. Switch to a browser on your Windows machine and paste the URL with Ctrl+V. Log in and authorise access.
- Copy the code. After you authorise, the browser shows an authentication code. Copy it.
- Paste it back into PuTTY. Return to the terminal and paste the code by holding Shift and right-clicking in the window. Press Enter. A plain right-click often won't work here, because Claude Code is capturing the mouse, so Shift is what forces the paste through. Shift+Insert also works.
That's the whole loop. Shift is the key in both directions: Shift and drag to copy the URL out, Shift and right-click to paste the code back in.
If Shift Still Doesn't Copy
Selecting text should copy it automatically, but some older PuTTY configurations have this switched off. To check, right-click the PuTTY title bar and open Change Settings, then go to Window and Selection. Make sure the mouse action is set to copy to the clipboard rather than nothing.
Handling Long Wrapped URLs
Login URLs are long and wrap across several rows, which makes selection fiddly even with Shift held. If it keeps splitting, widen the PuTTY window before you trigger the login again by dragging the window edge wider. When the URL prints on a single line, it's far easier to select cleanly.
Skipping the Browser Step
If you'd rather avoid the copy and paste dance entirely, Claude Code has a way to authenticate with a token instead of the browser flow, which suits headless and remote servers well. The exact command changes over time, so check the current Claude Code documentation for the token login method rather than following an older guide.
Quick Reference
- Start Claude Code: run
claudeand wait for the login URL - Copy the URL: hold Shift and drag, or Shift and triple-click for a wrapped line
- Authorise: paste the URL into a browser and log in
- Copy the code: grab the authentication code the browser shows
- Paste it back: hold Shift and right-click in PuTTY, then press Enter
Conclusion
The PuTTY login problem looks like a bug, but it's just two normal behaviours stacking up: PuTTY's mouse-based copy and Claude Code capturing the mouse. Holding Shift steps around both. Once you've done it once, logging in over PuTTY takes a couple of seconds, and the same Shift trick works for every other terminal tool that grabs the mouse.
