I want to mount a SMB share with different user credentials. Therefore I want to use
mount -o nodev,nosuid -t smbfs //user:pass=<word@host/share /mnt/share
However, this command fails:
-bash: word@host/share: No such file or directory
When trying to pass the password via a variable, I get:
$ export PWD="pass=<word"
$ mount -o nodev,nosuid -t smbfs //user:$PWD@host/share /mnt/share
mount_smbfs: URL parsing failed, please correct the URL and try again: Invalid argument
mount
on other systems seems to accept username and password as mount options, like:
$ mount -o nodev,nosuid,domain=mydomain,username=user,password="pass=<word" -t smbfs //host/share /mnt/share
or via a credentials file:
$ cat credentials.txt
username=user
password=pass=<word
domain=mydomain
$ mount -o nodev,nosuid,credentials=./credentials.txt -t smbfs //host/share /mnt/share
However, both ways are not available with macOS' mount:
mount_smbfs: -o credentials: option not supported
mount_smbfs: -o domain: option not supported
mount_smbfs: -o username: option not supported
mount_smbfs: -o password: option not supported
So the question is: How to provide the password to macOS' mount_smbfs? I'm aware that changing the password would solve the problem, but for reasons this is not an option.
bash
and the version is GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)