Mac os mount smb share

Mac os mount smb share

O.k. so I tried this hint out. Yes it worked. Now how do I unmount the share ? I’ve tried telling the share icon on my desktop to eject, but it claims to be in use. I have no files opened from the share.

This seems to be a bug in 10.1.5 Normally, you would find the share mounted in /Users/name/share (if you followed the original hint) and would unmount it with:

sudo umount /Users/name/share

However, this does not work. I was able to remove the share by making a second connection in the Go menu Connect to Server and then dragging the
new share icon to the trash, e.g:

I connected to smb://workgroup;hostname/mp3 which is the same share I had mounted as «share». When I tossed the mp3 icon, I got a volume in use error, but both the mp3 and share icons disappeared.

I don’t know if you have received an answer but I just found out how to do this and thought I would share.
I tried to use umount / and it didn’t work. The reason I knew it didn’t work was because I mounted the share with the Connect to server option in the finder and it would append a «-1» to the share name. I used the mount command without parameters and saw that it still had the share mounted at /Volumes/share. I used umount /Volumes/share and it worked fine.
HTH,

Would someone please make a small tutorial of this. An example, for instance. For example, what is the «sharename.» And is it just me who can access the other one’s files now or if it is two way sharing? And if it works with PCs too. We’ve tried to share files on my cousin’s PC and no luck so far. Haven’t tried this hint yet.

mounting an smb share should be as easy as:

where «servername» is the NetBIOS name of the server (an IP address may also be substituted), «user» is a valid user on that server, and «share» is the name of the share you wish to mount locally (you’ll most likely have to create the /Volumes/share directory)

I’ll also note that if you place your mount in the /Volumes directory, Finder.app will see it, and place an icon for it on the desktop (assuming your Finder preferences are set to place shared volumes on the desktop). If the share isn’t appearing on your desktop, use the Go to folder. command in the Go menu in the Finder, and point it to /Volumes, the share will appear on the desktop as soon as you click on its icon in the Finder.

doing a manual mount like this will leave Finder.app unable to unmount the share, but if you feel the need to manually mount a share, you should of course be prepared to manually unmount it using:

If you are still having troubles unmounting the share, unmount as root:

none of this functionality requires anything remotely related to fink, as it is standard Darwin functionality

The only time you should ever need to manually mount a share is if the share name has a space in it, or you need to specify some really weird SMB options, which in most cases, nobody would need to do.

On the other hand, mounting it manually is a good way to emulate the Windows «reconnect on startup» to networked drives. I can’t remember the file offhand, but I already have «special» mounts for my /Users partition, and I’m sure all of the swap-drive hacks are similar. Putting in the mount_smbfs there would connect to the other computer every time you start up. I imagine this would happen for every user, though, which may not be a good thing. Likewise, if the volume is not available, it may not be to graceful when it tries to mount. I’ll have to look into this, because my 60GB iMac drive is getting kinda full, and my Windoze-box is near emtpy — plenty of extra storage there!

Читайте также:  Windows 10 pro activation key besplatno

Wouldn’t this hint make it easy to create an applescript of some sort that would automatically mount the same share every time. This could be faster than having to use the Go menu.

I wish mounting shared volumes worked like iDisk .

You could add it to a .profile/.login, then fire up a shell.

Sometimes I find it faster to copy files through the command line to windows shares. So, if I’m there, I mount the share that way.

Use %20 for a space in your shares.

See: http://kbase.info.apple.com/ and search for 106471 to get the appropriate knowledge base document «Mac OS X 10.1: How to Connect to an SMB Volume (Microsoft Windows)»

I’ve set up my linux box as a samba server on a wireless network and it works beautifully as a file server to my partner’s Windows 2000 laptop and my OS X iBook, but only my partner’s machine can see and print to the printer (via samba) that is attached to the linux box. The ignominy! Anyone have a solution to this? I’ve searched the net and Google Groups far and wide. it’s gotta be possible.

Well, I still maintain there is a bug here. I realize «whatnot» covers a lot of ground, but on any other version of Unix, you can mount a share anywhere you want and unmount it at will. In OS X, you get a cute icon on the desktop if you do a «normal» mount, .e.g. /Volumes/whatever, but if you follow the instructions in the original post, you don’t get the icon until you click on the share and then you can’t unmount the share.

Permissions has nothing to do with it and remounting the share on a different mount point should not suddenly allow the original mount to go away, especially since there is an «in use» error message, but it still unmounts, hence the bug.

Applescript can also be used to very easily mount SMB shares. You can either put the applescript icon on your desktop for double-click access, or you can put it in your login items.

The exact applescript is as follows (simple!)

tell application «Finder»
open location «smb://user:password@computername/sharename»
end tell

tell application «Finder»
open location «smb://administrator:danwarne@mailserver/c»
end tell

So simple, so obvious, yet so overlooked. This tip deserves to be on the main page.

Ouch! Schooled by both dwarne and monkeyvoodoo on the same tip!

Thanks though. This applescript rocks!

I have used the above and it works wonderful. how ever since i have upgraded a computer to 10.2 it seems not to work. I get the following error: «Finder got an error: an error type of -10814 has occurred» The exact script is as follows:

tell application «Finder»
open location «smb://henry/student»
end tell

I thought I was alone until some students have also reported the same error on their 10.2 systems.

Any help would be appreciated.

I think that things changed in Applescript 1.9. This format works for me in 10.2.1:

Hope that helps.

How would I dissconnect shares using Applescript? I connected them using the applescript command to /Volumes/ .
thanks for any help, thorsten

tell application «Finder»

    eject (every disk whose name is «sharename»)

end tell

The correct syntax is «mount volume».

I found this useful to create a Favorite for a WebDAV volume hosted on a nonstandard port.

Is the process any different when you need to log in to a machine on a differnt domain that what you are in? I need to connect to a machine across domains and to the root. The following does not work for me.

Nevermind. Found the answer in a different thread. and also referenced at developer.apple.com: Using SMB on OS X

This is exactly what I need and works great.

Just one question (from an AppleScript newbie):-

Can you tell it not to actually open the Finder window as it now does it everytime I log in?

Use the following Applescript to mount smb drives in the background without opening Finder windows. The mount point is automatically created in the /Volumes directory. For a user with a login name of «forman» on a server called «vortex» with SMB shares called «local» and «scratch» use the following script: Save the script as an application using the Script Editor and put it in System Preferences -> Accounts -> Startup Items to mount the drives when you log in.

To mount the share quietly using your keychain record, use:

osascript -e «try» -e «mount volume \»smb://user@server/share\»» -e «end try»

Читайте также:  Windows для очень слабых нетбуков

I followed the same steps as you mensioned , still getting the following error

mount_smbfs: tree connect phase failed: syserr = No such file or directory
mount_smbfs: tree connect phase failed: syserr = No such file or directory

Thanks in advance.

A much easier way to mount a volume at startup time: Mount the volume once, then open System Preferences->Accounts->Login Items and drag the volume into the list. No Applescript or command line work needed; the Finder just does it for you.

Источник

Access and Mount an SMB Share via Command Line

Do you need to access and mount an SMB share from the command line on a Mac? You may be used to connecting to Windows PC from the Mac networking features to mount a Windows share on Mac, but you can also connect to Samba shares from the Terminal too.

This article will show several ways to mount and access SAMBA / SMB network shares from the command line of Mac, including with the latest MacOS versions and older Mac OS X releases too, as the process is different depending on the system you are using.

How to Access & Mount SMB Shares via Terminal on Mac

In newer macOS versions, you can can accomplish this with “mount_smbfs” command and it’s rather simple:

mount_smbfs //USER@192.168.0.105/myshare /mnt/smbshare

Replace USER, the IP address, the share name, and the share mount point, and that’s all there is to it.

Of course you’ll have to login and authenticate to the network share, unless it’s a GUEST user login.

You can also unmount the SMB share with the ‘unmount’ command as usual.

Accessing & Mounting SMB Shares in Older Mac OS X Versions

For older versions of Mac OS X, OSXDaily reader Dan Luna sent in the following tip on accessing Windows shares on the Mac from the command line:

“My Mac is nestled into a sea of Windows PC’s at the office, and so I am frequently accessing SMB shares to share data and files. Accessing SMB/Windows shares on the Mac is really easy from the GUI but I spend a lot of time in the command line and I always like to find a way to do things using the underpinnings of Mac OS X. With this in mind, here’s how to access SMB shares via the command line in Mac OS X:”

Earlier versions of Mac OS X could break this into several commands like so, to first list the available SAMBA shares at the destination IP:

smbclient -U user -I 192.168.0.105 -L //smbshare/

(Note that some of the newer versions of OS X use “smbutil” instead of smbclient)

Now you’ll want to pass set your SMB shares mount point:

mount -t smbfs -o username=winusername //smbserver/myshare /mnt/smbshare

And finally you’ll want to gain access to the SMB share by specifying your Windows login and the machines IP address:

mount -t cifs -o username=winusername,password=winpassword //192.168.0.105/myshare /mnt/share

Thanks for the tip Dan! I haven’t been able to check if this works because I’m on an all Mac network with later Mac OS releases, but the commands seem valid so I see no reason it wouldn’t.

Obviously you’ll need to fill in your own unique usernames, sharenames, IP addresses, mount points, etc.

I really appreciate Dan’s tip and it’s a great advanced trick to use for terminal users, but for some Mac users who prefer the GUI then mounting Windows shared folders through Mac Finder is probably easier.

Источник

natritmeyer / mount_smbfs.sh

# 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

This comment has been minimized.

Copy link Quote reply

SaundersB commented Oct 21, 2015

This comment has been minimized.

Copy link Quote reply

schovi commented Nov 7, 2016

Awesome. Behaviour of Finder is really really really bad 🙁

This comment has been minimized.

Copy link Quote reply

vbotay commented Jan 26, 2017

Does anybody know workaround if password ends with ‘!’ ?
In that case I have following error message

This comment has been minimized.

Copy link Quote reply

mschwartz commented Apr 6, 2017 •

This comment has been minimized.

Copy link Quote reply

S99P commented Oct 4, 2017

After reading this I tried:

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

Читайте также:  Рег файлы для windows 10

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)

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

Источник

Автоматизация монтирования samba-разделов в Mac OS

Причины неудобств

Каждый раз для подключения к самбе надо изрядно потыкать мышкой: Finder -> Подключение к серверу -> ввод имени сервера (-> первый раз ещё и пароль спросят) -> выбор папок, которые нужно подключить -> Ok. Потом, если захочется делать бэкап в примонтированную по самбе директорию, прийдётся ещё и образ .sparsebundle создавать, и монтировать ещё и его. Всё это, возможно, и не сильно напрягает, если делать раз в пару недель на стационарном ПК, который постоянно находится в одной и той же сети и не выключается так же, как и сервер. Но когда это надо делать после каждого включения/пробуждения ноутбука — это ни в какие ворота не лезет. Плюс к этому выяснилось, что если не отмонтировать разделы и сменить сеть (скажем прийти к соседу в гости), то система изрядно виснет после выхода из сна, ибо не находит сервер с шарами, а, в редких случаях, ещё и в kernel panic случается. Всё это сильно омрачило радость поднятия сервера и мечты о том что больше я даже вспоминать не буду о бэкапах, пока они мне не понадобятся (тьфу тьфу тьфу). Было решено, что процесс нужно автоматизировать.

На первых порах

В попыхах были нагуглены способы монтирования самбы и тут же родился маленький скрипт из парочки идентичных команд следующего вида:

Так же было найдено как сделать аттач образа для TimeMachine:
hdutil оказался более смышлёным и создание папок не потреловал.
Первая версия скрипта была готова.

Безопасность

Очень напрягало указание пароля в явном виде при монтировании. Почитав ман для mount_smbfs узнал про nsmb.conf. Но идея так же не шибко понравилась, так как всё равно пароль хранится где-то в файле в открытом виде. Тут же вспомнил, что через GUI пароль спрашивают единожды, а далее вытаскивают из keychain. Захотелось использовать её. Оказалось автоматически, как если бы взял nsmb.conf и дописал ключик -N к mount_smbfs, пароль подставляться не будет (чуда не произошло). Прийдёся его сначала получать через security и затем передавать в нужное место. Для сих целей была нагуглена и переделана под свои нужды функция:

После этого явное указание пароля было заменено на:

Паранойя отступила, но любознательность и перфекционизм остались, поэтому дело продолжилось.

Улучшения и расширение

Захотелось сделать один скрипт для монтирование всего и сразу, да так сделать, чтобы он расширяемый было и повторять код много раз не пришлось, плюс чтобы смотрел что уже в системе примонтировано и второй раз монтировать не пытался. Сказано — сделано. Опишу всё по-порядку.

Для определения примонтированости, на первом этапе, был использован самый «топорный» метод

Но сразу же стало понятно, что директория может и присутствовать, но не являться точкой монтирования для чего-либо. Поэтому сделал функцию для проверки:
Метод тоже не идеален, но уже гораздо лучше, нежели простая проверка наличия директории.

То же самое было сделано и для проверки образа бэкапа:

После некоторых раздумий и чтения форумов метод раздулся и стал сразу проверять примонтирован ли образ, и, если нет, то монтировать его.

Далее нужна была функция для выполнения проверок и автоматизации по монтированию любого количества шар с сервера. Вот какой она получилась:

Внимательный читатель заметит, что во-первых: можно и имя сервера передавать в параметрах к функции, а не хардкодить его, а во-вторых: в скрипте встречается неизвестная функция is_samba_exist.

Отвечаю по-порядку: 3-й параметр для функции было делать лень, ибо пока второго сервра с самбой не планируется; функция is_samba_exist имеет следующий вид:
Несложно догадаться, что функция проверяет наличие шары с указанным именем в текущей сети.

Таким образом основная часть скрипта стала простой, понятной и расширяемой:

На последок, по образу и подобию вышеописанного скрипта, был создан ещё один, но уже для отмонтирования сразу всего:

Вот и всё. Дальше скрипты были унесены к своим собратьям в

/.script. Получили короткие алиасы в .bash_profile и стали помогать мне с самбой.

Перспективы

В будущем, когда дойдут руки, хочется подружить скрипты со SleepWatcher, дабы выполнялись они после выхода из сна и перед уходом в него же. То есть, чтобы совсем ничего не надо было делать руками и автоматизация стала полной.

Источник

Оцените статью