大网数据广告活动
服务器运维问答

Password prompt when accessing samba share through autofs

· 52CE 我爱测

We have a file server on Ubuntu Server 16.04 using Samba which uses an external LDAP server for authentication. Additionally, the LDAP server has an automount definition for the file server's Samba shares (with automountInformati…

问题原文

原帖链接 · Hsn723 · CC BY-SA 3.0

We have a file server on Ubuntu Server 16.04 using Samba which uses an external LDAP server for authentication. Additionally, the LDAP server has an automount definition for the file server's Samba shares (with automountInformation: -fstype=cifs,rw,username=& ://fileserver/share/&) and tested working.

On our web server, we are automatically mounting the above mentioned shares. The problem is that when users cd into their shared home they will get a Please enter password with the systemd-tty-ask-password-agent tool! over Wall.

I've looked up that error message, and it seems that the "solution" is that users need to enter their password in another terminal session, which is not acceptable in our situation. After experimenting a bit with a colleague, and some reading around, we've found that restarting the autofs service twice will bring the password prompt to the current console. However, that is further unacceptable because autofs needs to be restarted twice (did I mention that requires sudo access?) for every password prompt (for every user).

Apologies for the long introduction. My question is, in our current setup is there any way we can have the systemd-tty-ask-password-agent tool prompt the users for their password on the same terminal session?

已采纳解答

原帖链接 · Hsn723 · CC BY-SA 3.0

I found the solution/mistake, leaving it here in case somebody else finds themselves in this situation. As it turns out, the mistake resided in the mount command. The correct command should be automountInformation: -fstype=cifs,rw,username=<some-user>,password=<some-password>,uid=&,gid=<some-groupname> ://fileserver/share/&.

What happens is that when using autofs from LDAP, if you do not provide login credentials for the samba shares it will pass that request to your client, which will only be able to answer as root. Which was why systemd-tty-ask-password-agent --query will fail for regular users.

My full solution ended up being to create a dedicated user for samba login with membership in some-groupname. When an LDAP user tries to cd into a share on the client, their uid gets supplied and the requested directory gets automounted, with their unix permissions applied.

In other words, the username and password parameters are used for samba authentication, whereas the uid and gid are used for authorization.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-10-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。