Is it possible to authenticate to a remote share by passing username and password in one line?

Posted on 2007-10-04
Medium Priority
Last Modified: 2013-12-04
I am looking at a way to authenticate to a remote share on a windows box. The share is from a workgroup but I can make it a domain if it helps.

What I want to setup is something like    \\computer\share\  username@workgroup password

I am sure I have seen something where you can pas this information through, but it may have been on web pages only.
Question by:cbpee
  • 3
  • 2
LVL 30

Accepted Solution

LauraEHunterMVP earned 1800 total points
ID: 20019101
You're thinking of FTP authentication.  The only way I can think of to approximate that for a Windows file share is the 'net use' command, which will map a connection but will still require you to browse to that connection separately.

So net use \\computer\share mysecretpassword /user:domain\usera will open a connection to \\computer\share using those credentials, but it won't actually open an Explorer window.

Assisted Solution

JjcampNR earned 200 total points
ID: 20019106
You can use the "net share" command to authenticate - which can pass the credentials of the currently logged on user, or a different user name, but I don't believe it will let you send the password.  Sending a password via a command or script over a plain TCP/IP connection is a bad idea anyway, you can easily sniff the packet and get the password used since it's passed in clear text.  Have you thought about using an SSH daemon for Windows?  What are you trying to do - perhaps there's another way?
LVL 30

Expert Comment

ID: 20019112
> "can easily sniff the packet and get the password used since it's passed in clear text"

Be careful with this statement - while the password may be -typed- in clear text on the user's console, how that password is transmitted across the wire depends on the environment, whether things like SMB signing are configured, and what level of NTLM authentication is supported.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 20019159
What Im looking to do I guess is to form a connection so that when we do open the share via \\computer\share we wont have to input the login details.

This is all done within a secure environemnt so no issues passing UN or Passwords.

So if the above does form a connection and thus passes information and when we make a normal windows share connectionit has already authenticated then great we wont have to re-input the UN or Password.
LVL 30

Expert Comment

ID: 20019205
Yes, if you do the "net use" that I listed above, the next time you opened that UNC path it would not re-prompt for usernames/passwords.  As I listed the command above, these credentials would be stored until the machine rebooted.  You can also map an actual drive letter using the /persistent switch to force the connection to survive a reboot, but this connection would need to be manually deleted and re-created whenever the user's password changed.

Author Comment

ID: 20019301
Many thanks guys, won big points with the boss over this one, it will save us entering on the logon information each day for 80+ servers.

Featured Post

When ransomware hits your clients, what do you do?

MSPs: Endpoint security isn’t enough to prevent ransomware.
As the impact and severity of crypto ransomware attacks has grown, Webroot fought back, not just by building a next-gen endpoint solution capable of preventing ransomware attacks but also by being a thought leader.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Security measures require Windows be logged in using Standard User login (not Administrator).  Yet, sometimes an application has to be run “As Administrator” from a Standard User login.  This paper describes how to create a shortcut icon to launch a…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Integration Management Part 2
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question