How to mount password protected windows share without sudo in shell script?

In order to pass a password in a shell script you will have to write:

sudo mount -t cifs -o password=asdasd,username=mc007,uid=1000 //192.168.1.105/cfmaster/ /PMaster/projects/x4mm/win

But there are situations you don't want to use sudo (build-scripts,...).

And so if you don't use sudo, the command will abort with:

only root can use "--options" option

Now, how can one mount network share with password from within a non-interrupting shell script?

thanks

10

1 Answer

As mentioned in the comments, user 'muru' suggests to look at How do I run specific sudo commands without a password?. After researching it seems the only official supported way to mount a password protected windows share from within a script.

It needs you to be a tech savy, and it needs you to alter system files with root permissions.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like