Mounting Network share that requires login/password

Eskobar
Contributor

I need to run a Powserhell script on the Mac fleet. The outcome is a json file created on a share.

The script requirements to ran:  mount the share, sign in with user credentials in order to create the file .

I need to run shell script prior running the Powserhell 

Any idea how to mount the share bypassing credentials ?

I tried below line without success.

Capture d’écran 2022-08-29 à 17.38.05.png

2 REPLIES 2

Eskobar
Contributor

@Shaw69  so it's nothing related to MacOS! 

SMB owner should edit his share : grant permission to guest and turn off login/password prompts.

Is that correct ?

AJPinto
Valued Contributor II

I mean, technically disabling authentication would work. However I would love to see an organization that would allow un-authenticated access to a sharedrive. That is a massive security vulnerability. 

 

I would approach this by also entering the password from CLI. Make a service account that has the necessary access to the server. Make a script to map the drive with the service account (have the user name and password in the script). To make things more secure look in to salting the password so it is obfuscated. 

 

This should get the job done. I don't have a way to test this unfortunately as running this in my environment will flag a security finding since the password is in clear text. Open handles mounting the volume, and lets you hard pass a username and password. adding ./mntpoint to the end may be something you need to do. 

 

 

open 'smb://user:password@server/folder'