A montagem e o acesso são duas coisas diferentes.
Para permitir que os usuários montem, o quarto campo no seu fstab deve conter user , por exemplo, %código%. Veja user,uid=myuser,… . Você pode não precisar, continue lendo.
Você dá a opção man 5 fstab . De uid=myuser :
uid=arg
sets the uid that will own all files or directories on the mounted filesystem when the server does not provide ownership information. It may be specified as either a username or a numeric uid. When not specified, the default is uid0. Themount.cifshelper must be at version 1.10 or higher to support specifying the uid in non-numeric form.
Outro fragmento:
mount.cifs -Vcommand displays the version of cifs mount helper.
Com man 8 mount.cifs especificado corretamente, a montagem com uid= não deve substituí-lo; então você pode até não precisar da opção sudo em user . Talvez você estivesse quase lá quando usou fstab , mas se fixou em não usar uid= . Há mais uma coisa embora. Ainda outro fragmento:
The core CIFS protocol does not provide unix ownership information or mode for files and directories. Because of this, files and directories will generally appear to be owned by whatever values the
uid=orgid=options are set, and will have permissions set to the defaultfile_modeanddir_modefor the mount. Attempting to change these values viachmod/chownwill return success but have no effect.When the client and server negotiate unix extensions, files and directories will be assigned the uid, gid, and mode provided by the server. Because CIFS mounts are generally single-user, and the same credentials are used no matter what user accesses the mount, newly created files and directories will generally be given ownership corresponding to whatever credentials were used to mount the share.
If the uid's and gid's being used do not match on the client and server, the
forceuidandforcegidoptions may be helpful.
Se eu acertar, um cliente e um servidor (quando configurado corretamente) podem ignorar sudo e usar a propriedade armazenada no servidor. Nesse caso, isso é relevante:
forceuid
instructs the client to ignore any uid provided by the server for files and directories and to always assign the owner to be the value of theuid=option.
Parece que esta linha em uid= pode funcionar melhor para você:
//windows-ip/share-folder \
/home/mysuer/testmount \
cifs \
forceuid,uid=NUMBER,credentials=/home/myuser/.smbcredentials,iocharset=utf8,domain=my-domain 0 0
Você monta com fstab (ou adiciona a opção sudo se realmente precisar). Sem a opção user , o sistema operacional tentará montar o compartilhamento automaticamente na inicialização. A rede pode ainda não estar disponível no momento, não sei se seu sistema operacional resolverá isso. Com noauto você pode usar systemd , o quarto campo começaria com:
x-systemd.automount,x-systemd.idle-timeout=1min,forceuid,uid=NUMBER,…
A alternativa é x-systemd.automount .