1

I'm trying to access the file system on a server (\\servername), which prompts for credentials. I want to pass the credentials directly, like \\username:password@servername, but it's not working.

An example: \\"FirstName LastName":"myp@ssword"@servername doesn't work. Notice the white space in the user name and the @ in the password. I want to support this.

Any idea on what I'm doing wrong?

Dante
  • 123
  • 3

1 Answers1

1

Assuming that you're on a windows machine, your syntax is all wrong.

C:\Users\me>net use  /?
The syntax of this command is:

NET USE
[devicename | *] [\\computername\sharename[\volume] [password | *]]
        [/USER:[domainname\]username]
        [/USER:[dotted domain name\]username]
        [/USER:[username@dotted domain name]
        [/SMARTCARD]
        [/SAVECRED]
        [[/DELETE] | [/PERSISTENT:{YES | NO}]]

See how that differs from what you're trying? The username needs to be preceded by the /user: switch with a single slash, not a double-backslash.

mfinni
  • 36,144
  • 4
  • 53
  • 86
  • I'm not trying to map anything to a drive, I'm trying to access a server's file system (\\servername) by supplying the credentials directly in that. But thank you for the reply. – Dante Sep 04 '13 at 15:38
  • The method you are using can work with HTTP but I've never seen it work with CIFS, maybe you are accessing a Web Folder (DAV)? You could do this with a Linux box using the **smbclient** utility but I am not aware of a way to do it via UNCs alone in Windows. Maybe try runas? – TheFiddlerWins Sep 04 '13 at 15:47
  • @Dante - mfinni is still correct even without a mapped drive. `Net Use \\server\share /user:DOMAIN\user password` is the command. Then any subsequent connections in Explorer, etc. to that share will use those credentials (even more so with the /SAVECRED). It's not mapping a drive, just creating the connection to the UNC path – TheCleaner Sep 04 '13 at 15:53
  • @TheCleaner is correct. You don't have to map a drive, but you do have to establish credentials with the UNC path. – mfinni Sep 04 '13 at 15:58
  • I thought I had seen it but you are right, it was in an url. Thank you for all replies! – Dante Sep 04 '13 at 18:07