Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error 1312 from net use when mapping samba share

I have written a service that monitors if my app is running and starts it if not. In result the app is run as a "system" user - which is the way I want it to be. I have several of those installations working properly. The app should mount a network share that is in this case available on a linux samba server. The problem is that when running the command:

net use X: \\IP\share_name /user:login password

an error is displayed:

System error 1312 has occured.

A specified logon session does not exist. It may already have been terminated.

I have run some checks and it turns out that the X: drive in local system is available, the server is online, the share is available, the credentials are OK, there are no other net use sessions running in this system. Also I have found out a strange behavior: running identical command as a standard user gives proper results and the drive is mounted properly. Do you have any suggestions what might be the problem and how to solve it?

Additionally I am not a domain member, and the system that shows the error is Windows 7 Pro. I have other machines in the same network that do work properly without the error.

like image 479
Maciej Avatar asked Sep 05 '16 08:09

Maciej


1 Answers

I have had the same issue some time ago. It helped when I introduced a domain name (even if you are not a domain member) before the login. I your case try this command: net use X: \\IP\share_name /user:whatEver\login password

like image 102
mdghost Avatar answered Oct 18 '22 06:10

mdghost