Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Salt-minion running as my user cant access network drive mounted by my user[BUG] #66321

Open
asmith2011 opened this issue Apr 5, 2024 · 5 comments
Labels
Bug broken, incorrect, or confusing behavior Windows

Comments

@asmith2011
Copy link

Description
I have mounted a network drive on my windows 2019 server. I did this through the gui with my user which is an administrator.
On my salt master i have tried to list the contents of this mounted drive simply using the this:
"salt MY_MINION cmd.run "ls W:/" shell=powershell"

This command reports
Cannot find drive. A drive with the name 'W' does not exist.

This same drive does exist if i log onto the server as the same user salt-minion is running as.
Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)

Please be as specific as possible and give set-up details.

salt version: 3007.0 (Chlorine) on master and minion.
Master OS rocky linux 9
Minion OS Windows Server 2019

Steps to Reproduce the behavior
Mount a network drive on salt minion machine. Attempt to execute remote command from master on the minion using the mounted drive.
Expected behavior
Should be able to access the network drive.

Additional context
I also tried to create the network mount from cmd by executing a remote command from the master using the "net use" command. which gives the error:
System error 67 has occurred.

The network name cannot be found.
@asmith2011 asmith2011 added Bug broken, incorrect, or confusing behavior needs-triage labels Apr 5, 2024
Copy link

welcome bot commented Apr 5, 2024

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at saltproject@vmware.com. We’re glad you’ve joined our community and look forward to doing awesome things with you!

@Timmeeh
Copy link

Timmeeh commented Apr 6, 2024

Is the salt-minion really running as the same user your GUI user? The default installs typically makes the salt-minion run via a service, as the SYSTEM user. This user does not always have access to resources created by regular users. You can verify by spawning a terminal as the SYSTEM user with Sysinternals' psexec tool.

@asmith2011
Copy link
Author

It wasnt by default but i have changed the logon settings for salt to run as that same user that i log into the gui with. I have confirmed the minion is running as that user by doing a whoami command sent from the master using cmd.run

@Zpell82
Copy link

Zpell82 commented Apr 8, 2024

https://github.com/saltstack/salt/blob/master/salt/modules/cmdmod.py#L4641-L4650C40

    This function does not process commands through a shell unless the
    ``python_shell`` argument is set to ``True``. This means that any
    shell-specific functionality such as 'echo' or the use of pipes,
    redirection or &&, should either be migrated to cmd.shell or have the
    python_shell=True flag set here.

    The use of ``python_shell=True`` means that the shell will accept _any_
    input including potentially malicious commands such as 'good_command;rm
    -rf /'.  Be absolutely certain that you have sanitized your input prior
    to using ``python_shell=True``.
   don't know if this is helpful or not 
   
   https://github.com/saltstack/salt/blob/master/salt/modules/cmdmod.py#L3838
   you also have the cmd.powershell option 

@asmith2011
Copy link
Author

I have tried setting the shell to powershell but the behaviour is the same. im not sure why Python_shell would make a difference but trying to get to the drive didnt work with python_shell=true

@dwoz dwoz added Windows and removed needs-triage labels Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Windows
Projects
None yet
Development

No branches or pull requests

4 participants