Skip to content

Connect a Mac to a SMB server - as Guest

One of the things I do in our network is public drives. Every Linux system has a public "incoming" which is mapped to the primary user of the device (if there is one, like for a laptop). And this incoming shared drive can be accessed without password.

This makes it really convenient to copy files around from one laptop/user to another, or from mobile devices to laptops and vice versa, or use the printer/scanner to send the scan job directly to the laptop of the user's device. All in all, the users like this, and use it a lot. There is also minimal protection built-in, it will only work in our home network, access is blocked when the laptop is connected to a different network. But the folders are mostly empty anyway. For sharing files over the Internet we also have a Syncthing instance running, but that's a different story, and not as easy to use.

One thing which I was annoyed about is that by default a Mac will try to connect as a registered user. There is an option "Connect as Guest", but it's not pre-selected. Therefore every time I wanted to share something between Linux and Mac, I had to start "Finder", to to "Go" and then "Connect to Server", then click on the server from the list of last entries, and then also click on "Guest". The built-in help is also not useful, as it only talks about "click on Guest".

But it turns out that one can "pre-select" the Guest user. For this, the username is "Guest", and there is no password. This goes between the protocol and the hostname. Example:




There has to be a ":" between the username and the (non-existent) password, and the credentials are separated from the hostname by a "@". Using this connect string will auto-connect as anonymous user to the remote share. One click and a couple seconds saved!



And while I am on it, here is the configuration for Samba to create a public incoming. In the following example my username is "ads" and my home on my laptop is "/home/ads". The incoming drive is mapped to "/home/ads/incoming".

  comment = incoming
  path = /home/ads/incoming
  writable = yes
  locking = yes
  public = yes
  browseable = yes
  guest ok = yes
  force create mode = 0777
  force directory mode = 0777
  force user = ads
  preserve case = yes
  hosts allow =

All files in this incoming are automatically owned by the user, which makes it easy to work with the directory content. That's done by the "force user" setting.


No Trackbacks


Display comments as Linear | Threaded

Jan on :

Its a standard idiom, to put username:password (separated by "@") in front of the destination of any url. $protocol://[$username[:$password]@]$host[:$port]/$ressourcepath is a standard thing (at least on the good old protocols) - try it with http(s) or ftp ... or ssh (without password)
Comments ()

Andreas 'ads' Scherbaum on :

Aware of how this works with other protocols. I never figured (until recently) the "Guest" part for this. And also I don't like that the Mac does not store this in the list of previous servers. It only stores the server itself, not the fact that one clicked "Guest".
Comments ()

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
To leave a comment you must approve it via e-mail, which will be sent to your address after submission.
Form options