-
-
Save natritmeyer/6621231 to your computer and use it in GitHub Desktop.
#Mounting the share is a 2 stage process: | |
# 1. Create a directory that will be the mount point | |
# 2. Mount the share to that directory | |
#Create the mount point: | |
mkdir share_name | |
#Mount the share: | |
mount_smbfs //username:password@server.name/share_name share_name/ | |
#Unmount the share: | |
umount share_name |
Does anybody know workaround if password ends with '!' ?
In that case I have following error message
-bash: !@10.0.0.3/Users: event not found
\!
After reading this I tried:
mkdir WinShare
I checked that it was there and then tried the mount_smbfs command with modification of variable names and ran:
mount_smbfs //leUserName:lePassWord@WinBox-pc/WinShare WinShare/
The shell wrote:
mount_smbfs: mount error: /Users/MyVolume/Desktop/WinShare: Unknown error: -1073741412
I checked that WinShare folder was where it was supposed to be (I was on the Desktop for everything, including Terminal).
I can't find error -1073741412 anywhere. Can anyone educate me? TIA
BTW I've opened the WinBox-pc using: open smb://WinBox-pc/DATA/ (opens the DATA folder on WinBox-pc)
So I tried:
open smb://leUserName:lePassWord@WinBox-pc/DATA/
and that works; we don't have to retype the Username and Password, and our target folder on WinBox-pc opens.
Again, can anybody educate me as to why this works but mount_smbfs doesn't?
TIA
s99p
im trying to use domain account to map a share on server, how can i enter username here?
smb://domainName\userName:password@server1/share1 ./share1
is this correct syntax??
thanks
@ikelca, no the format is:
smb://domainName;userName:password@server1/share1 ./share1
My password had some special characters in it, using encodeURIComponent('my password123!%%^^')
from any browser's web inspector or node should work fine.
wheres is my problem ??
I can connect to server with this:
smb://domain;user:password@ipaddress/folder/subfolder
But I can not connect from terminal:
mount_smbfs smb://domain;user:password@ipaddress/folder/subfolder
But I can not connect from terminal:
mount_smbfs smb://domain;user:password@ipaddress/folder/subfolder
mount_smbfs smb://domain;user:password@ipaddress/folder/subfolder /your_local_pre_existing_folder
Also you can specify the attributes like: -f 0755 -d 0755
mount_smbfs: mount error: /Users/machenchi/shareDev: No such file or directory
But I have made a dir with mkdir /Users/machenchi/shareDev
for special character in password, see here https://stackoverflow.com/a/37179333/2292993. replace with special code
@ -> %40
$ -> %24
! -> %21
mount_smbfs: mount error: /Users/machenchi/shareDev: No such file or directory
But I have made a dir withmkdir /Users/machenchi/shareDev
@vaxilicaihouxian, any success?
mount_smbfs: mount error: /Users/machenchi/shareDev: No such file or directory
But I have made a dir withmkdir /Users/machenchi/shareDev
@vaxilicaihouxian, any success?
No
Guys I had a similar problem and created a script for this. I had the problem with passing a domain name as username containing a backslash and a very secure password containing a lot of special characters. Here you can see it.
I also have made a script that mounts shares automatically and uses the keychain so it is non-interactive. Should I upload it as well? I use it everyday and trigger it with ip-up (ppp), so all my network shares connect automatically every time I connect to a specified VPN.
I actually had to scape ';':
mount_smbfs smb://domain;user:password@ipaddress/folder/subfolder /your_local_pre_existing_folder
@x3l51 It would be great if you could share the script you made that mounts shares automatically and uses the keychain so it is non-interactive.
@x3l51 Awesome, could you share the script that mounts shares automatically and uses the keychain?
Thank you! This speeds up my transfer of over a gig of data tremendously. Finder is HORRIBLE!
This requires root on macOS 10.15.7, and the resulting mount will be root-owned and require root to access.
@j3pic, since macOS 10.15 you can still mount to your user directory without root.
For example use shortcut: ~/your_share
It will get mounted in: /Users/your_username/your_share
Also check "man mount_smbfs" - it teaches you about soft, sessionencrypt and shareencrypt parameters. Very useful :)
@Traace No, it doesn't work unless you're root.
If you try it from a non-root account, one of the following two errors will happen:
If the mount-point (~/your_share
in your example) is an existing directory, you'll get this error:
mount_smbfs: mount error: /Users/your_username/your_share: File exists
If the directory does not exist, you'll get this error instead:
mount: realpath /Users/your_username/your_share: No such file or directory
If you do it as root, the operation will succeed (edit: if the mount-point directory exists), but the mount will be owned by root
.
It doesn't matter if you use mount -t smbfs ...
or if you call mount_smbfs
directly.
This saved me today, thanks for posting!
@j3pic. Something else must be going on.
On Monterey I just did: mount -t smbfs //username@server.local/share ~/mnt
. It mounted without error and I can access it without needing sudo.
@j3pic @easp The user must be an admin in order to run the mount or mount_smbfs commands because both exist in /sbin. It will be owned by the account that runs the command. In my case, I am trying to run some form of this command in a script from Jamf for a Standard user to access. I have been able to make this work by doing running this as root:
sudo -u localUser mount -t smbfs //username@server.local/share ~/mnt
@spartaaa-git Why do people keep insisting that this works? It doesn't. My account was admin. You have to be root. The command you suggested exhibits the same behavior I described originally.
@easp Monterey deprecates all kinds of features on Intel Macs. I won't be upgrading to it.
If you're wondering why this won't work for connecting with a very old share (Win98!) in monterey and you see:
joey@ghostbook mnt % mount_smbfs //tinyking98/c tinyking
mount_smbfs: server connection failed: Unknown error: -5996
this shows up in Console.app:
smb1_smb_negotiate: Support for the server TINYKING98 has been deprecated (PreXP), disconnecting
adding this to /etc/nsmb.conf doesn't help:
[default]
# allow SMB 1+2+3
protocol_versmap=7
edit:
It turns out this notice is present in older versions too; google shows a complaint on El Capitan, I got it in Catalina.
you can find the source of the error log here:
https://github.com/apple-opensource-mirror/smb/blob/98c9fff3ade4b449013c0d106c45b6ffb35cf609/kernel/netsmb/smb_smb.c#L421
else where in that codebase, we see that
#define SMB_ENETFSNOPROTOVERSSUPP -5996
😭
it only seems to show when using the mount_smbfs tool and not via the Finder.
I have an old PPC eMac running 10.5.8 (Leopard) and the mount succeeds on there!
Can update the gist for Monterey which requires adding WORKGROUP
?
mount_smbfs //'WORKGROUP;username':password@remote-host/shared local-mount-point/
mount_smbfs: mount error: /Users/machenchi/shareDev: No such file or directory
But I have made a dir withmkdir /Users/machenchi/shareDev
@vaxilicaihouxian @mwmcode I had the same issue. I fixed it by putting the last argument (i.e the mounting point) in quotes. So, the original command becomes:
mount_smbfs //username:password@server.name/share_name "share_name/"
For those who keep getting File exists
without sudo
it may be that you already have that drive mounted in Finder. In my case I was exploring the drive in finder. When I unmounted that it worked a charm.
Details and an automation script available: https://stackoverflow.com/a/78877529/945789
Awesome. Behaviour of Finder is really really really bad :(