如何查找Windows 7本地OpenSSH服务器登录凭据及解决Putty连接权限问题
Let's walk through why you're hitting this "access denied" error and how to get the right login credentials sorted out.
First: Forget the /etc/passwd file on Windows
Windows' OpenSSH implementation doesn't rely on the Unix-style /etc/passwd file for user authentication—it uses Windows' native local user account system instead. That empty or unhelpful passwd file you found is normal here; it's just a compatibility mapping file that rarely has the user info you need.
The Correct Login Credentials Are Your Windows 7 Local User Details
Your SSH login should use a valid local Windows 7 account and its corresponding password. Here's how to confirm and use them properly:
- Find your valid local usernames: Open a Command Prompt (
cmd.exe) and runnet user—this will list all active local user accounts on your Windows 7 machine. These are the usernames you should try. - Use the right username format: If you're logging in locally (from PuTTY on the same machine or a networked device), you might need to prefix the username with
.\to avoid confusion with domain accounts (e.g.,.\Vladislavinstead of justVladislav). - Double-check the password: The password you need is exactly the password you use to log into that Windows account—if you set a separate password during OpenSSH installation, it likely synced with your Windows account password, so stick to your regular login password first.
Fix Common Configuration Issues That Cause "Access Denied"
Even with the right credentials, these settings might block your login:
Enable password authentication in SSH config:
- Open the hidden
C:\ProgramData\ssh\sshd_configfile (use Notepad or a text editor with admin rights). - Look for the line
PasswordAuthentication—make sure it's set toyes(remove any leading#to uncomment it if needed). - Save the file, then restart the OpenSSH SSH Server service (open Services via
services.msc, find the service, right-click > Restart).
- Open the hidden
Verify user access permissions:
- In the same
sshd_configfile, check forAllowUsersorAllowGroupslines. If these are set, your username must be listed here (e.g.,AllowUsers Vladislav). If they're commented out or missing, all local users are allowed by default. - Ensure your Windows account isn't disabled—run
net user <your-username>in Command Prompt to check the "Account active" status.
- In the same
PuTTY-specific tweaks:
- In PuTTY's Session window, make sure you're connecting to the correct IP (localhost for local testing, or your Windows 7 machine's network IP) on port 22.
- Go to Connection > SSH > Auth and uncheck "Attempt authentication using Pageant" if you don't have an SSH key set up—this forces PuTTY to prompt for a password.
- Alternatively, go to Connection > SSH and set "Preferred authentication method" to
passwordto prioritize password login over key-based attempts.
Test the Credentials Locally First
To rule out PuTTY issues, open a Command Prompt and run ssh <your-username>@localhost—if this works, the problem is likely with your PuTTY configuration, not the credentials.
内容的提问来源于stack exchange,提问作者Vladislav Vazhenin

