1

I have a samba share that does not require password. Here are non-default lines in my smb.conf:

[global]
map to guest = Bad User

[distr-ro]
        path = /home/distr
        public = yes
        writable = no

On RHEL6 I added this line to /etc/auto.master and it worked:

/cifs   /etc/auto.smb --timeout=60

But on Centos 7 attempt to access the share hangs and I see a broadcast message

[root@wc8 etc]# ls /cifs/okdistr/distr-ro

Broadcast message from root@wc8 (Wed 2016-03-02 03:51:45 EST):

Password entry required for 'Password for root@//okdistr/distr-ro:' (PID 10006).
Please enter password with the systemd-tty-ask-password-agent tool!
  • You need a better auto.smb script. Unfortunately, all those I found fail in various situations. I'm working on writing my own now... – mivk Jul 17 '18 at 9:16
  • @mivk guest mount option helps. See below. – basin Jul 17 '18 at 10:45
  • guest only "helps" if the server accepts listing shares without authentication of course. Which by default, most servers don't. – mivk Jul 17 '18 at 12:20
1

I had this same annoyance. Eventually, I ended up switching the automounting to systemd.

You have to create a file in /etc/systemd/system for the mount. Naming conventions require that to be named after the mount point with the path separator replaced by dashes. Since you have a dash in the name already, you'd have to figure out how to escape that.

In my case I added /etc/systemd/system/smb-Tomato.mount.

[Unit]
  Description=cifs mount script
  Requires=network-online.target
  After=network-online.service

[Mount]
  What=//<IP of server>/<path on server>
  Where=/smb/Tomato
  Options=guest,uid=<my UID on client>,gid=<my GID on client>,rw
  Type=cifs
[Install]
  WantedBy=multi-user.target

Then I had to enable and start this mount:

sudo systemctl enable smb-Tomato.mount
sudo systemctl start smb-Tomato.mount  

Since I wanted automount I also created a file /etc/systemd/system/smb-Tomato.automount containing:

[Unit]
  Description=cifs automount script
  Requires=network-online.target
  After=network-online.service

[Automount]
  Where=/smb/Tomato
  TimeoutIdleSec=10

[Install]
  WantedBy=multi-user.target

and simiarly enable and start this

sudo systemctl enable smb-Tomato.automount
sudo systemctl start smb-Tomato.automount  

So far I'm satisfied: the annoying broadcast message has disappeared.

After doing this I figured that just using the 'guest' mount option might have done the trick, but since I already have what I was after I did not revert to try this out.

  • Your last sentence was helpful: /cifs /etc/auto.smb --timeout=60 guest – basin Jul 17 '18 at 10:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.