Knowledge - Details


How to connect to SMB share as a different Windows user
Date Added: 3/5/2023

Problem:
When you connect to a remote SMB share from your Windows computer, your computer will try to log into that share with the username of your current local user account.  If the remote PC happens to have a user account with the same username and password, everything will work fine.  But, there are reasons you might need to specify a different credential:
1) If the remote PC has an account with the same username but a different password
2) If the remote PC has an account with the same username, but that SMB share has permissions that require a different username.


Solution:
# Instruct Windows to connect to that remote PC using specified credentials:
cmdkey /add:TheRemoteHostname /user:TheRemoteHostname\TheUsernameYouWantToUse /pass:ThePasswordYouWantToUse

# Then, whenever you connect to TheRemoteHostname, your computer will try to log in with TheUsernameYouWantToUse ; pass:ThePasswordYouWantToUse.

Troubleshooting:
# see the list of saved credentials
cmdkey /list

# remove a saved credential
cmdkey /delete:TheRemoteHostname



Back to List

Disclaimer: Everything on this website is written for my own use. I disclaim any guarantees that the procedures and advice listed here are accurate, safe, or beneficial for anyone else. If you attempt to follow any procedures or advice shared here, you do it at your own risk. Part of IT work is knowing how to recover from problems.