Mounting SMB network share on desktop

隐身守侯 提交于 2019-12-04 18:02:08

If you want to do this this the kosher, Finder-like way, do it in AppleScript via shell via Python:

os.system("osascript -e 'mount volume \"smb://server/servershare\"'")

You don't need anything else -- there's no mount point. This is identical to choosing "Connect To Server", and the resulting volume will show up in /Volumes as expected.

If you need to specify a username and/or password, you can do so:

os.system("osascript -e 'mount volume \"smb://server/servershare\" \
as user name \"myUserName\" with password \"myPassword\"'")

If you want to do it your original way using mount_smbfs, I think you want directory to be a folder you create in /Volumes, e.g. /Volumes/mySmbVolume, though I've never tried to do it this way. As you have it written, you're replacing your actual Desktop folder with the volume you're mounting. You could, however, make a folder inside Desktop for and use that for directory, and it might work. However, I'd do it like I wrote it to be most standard with the usual Mac way of doing things.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!