Remap UID in samba share

Is it possible to remap the UID (and GID) that is being reported to a samba client? It looks like it may be possible with the various idmap options, but it looks overly complicated for the simple remap I want to accomplish and I’m confused as to whether this is even the right approach.

Consider two machines A and B. Machine A has user smbuser with UID 701. Machine B only has a root user with UID 0.

smb.conf excerpt from machine A:

[share1]   path = /tmp/share1   valid users = smbuser 

On machine B:

mount -t cifs -o username=smbuser,pass=**** //10.1.1.11/share1 /mnt ls -l /mnt 

I see:

drwx------  701  701       0 Jan  1 00:00  . drwx------  root root      0 Jan  1 00:00  .. -rw-------  701  701      42 Jan  1 00:00  testfile 

I want:

drwx------  root root      0 Jan  1 00:00  . drwx------  root root      0 Jan  1 00:00  .. -rw-------  root root     42 Jan  1 00:00  testfile 

TL;DR: I need samba to remap UID 701 -> 0 when feeding directory lists to clients.

No write access to samba share


Scenario

  • Kubuntu desktop 18.04, tower
  • Lubuntu desktop 18.04, laptop
  • Windows 10, laptop

Kubuntu

  • I installed and configured samba server as per Install and Configure Samba in Ubuntu 18.04 Bionic Beaver
  • My addition to /etc/smb.conf:
[kubuntu_home]    path = /home/myusername    available = yes    valid users = myusername    read only = no    browseable = yes    public = yes    writable = yes 
  • I thought that there was a typo on the website, but when I checked it out on samba.org, I found that writable is a synonym for writeable.

Lubuntu

  • I mounted the samba share as per How to Mount Samba Share in Ubuntu Linux
$   sudo mount -t cifs -o username=myusername,password=mypassword //192.168.###.###/kubuntu_home /mnt/kubuntu_home 

Windows

  • I mounted the samba share as per How to connect to Linux Samba shares from Windows 10

Problem

From Lubuntu, I can read files but cannot write.

  • From Kubuntu, ls -l ~ shows files and directories as belonging to myusername myusername.
  • From Lubuntu, ls -l /mnt/kubuntu_home/ displays all files and folders as belonging to root root.
  • Somewhere along the way, I saw a suggestion to add force user = myusername to smb.conf. This did not make a difference.
  • No problems reading/writing from Windows.

How to automate the mounting of a Samba shared directory ith each reboot (fstab already created)

I have two Linux/Ubuntu boxes.

  • Box A (192.168.1.10): works as a file server, with Samba installed. It’s always switched on.
  • Box B: workstation with my office tools, which I reboot each time I need to work with it.

In Box B, I have ‘/etc/fstab’ modified:

//192.168.1.10/SambaSharedDirectory /mnt/SambaFiles cifs username=tom,password=foo,rw,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0 

However, each time I reboot Box B, I have to do ‘sudo mount -a’ to mount the file directory of Box A.

Is it possible to automate it to avoid mounting it with every reboot? Thank you very much.

Samba Server on Ubuntu 18, windows 10 client slow search

I have a samba server installed on debian. I use smb to get a network drive on windows.

When i want to search with the windows search engine through my network folders, it takes hours. Is there a solution to speed up the search engine? I’ve read something about indexing but no one on the hole internet has the same problem….

Server: E3 1220v6 8GB RAM 2* 1TB SSD

Config:

[global] workgroup = smb security = user map to guest = never server role = standalone server  #[homes] #comment = Home Directories #browsable = no #read only = no #create mode = 0750  [restricted] valid users = user #Wir beschränken den Zugriff auf den User 'user'' #valid users = @user #Alternativ kann auch auf eine Benutzergruppe eingeschränkt werden path = /media/storage/ public = no writable = yes browseable = yes comment = smb restricted 

unable to access location (failed to mount Windows share:permiss.denied) when trying to open a samba shared map

On my AcerAspireone I have Windows7 and Ubuntu. I have installed samba in order to access my windows files over a network (from W10). I mounted the windows partition and created a share of the windows map in that partition. On the Ubuntu system the partition is mounted in /media/pp/Acer. I created a local network share for the Windows folder in /media/pp/Acer and called it WindowsAcer2 and checked the “allow others….” My smb.conf is:

[global]  workgroup = WORKGROUP  server string = Samba  Server %v  NetBIOS name = ubuntu  security = user  map to guest = bad user  name resolve   order = bcast host  dns proxy = no  [WindowsAcer2]  comment = W7dirWindows  path =/media/pp/Acer/  browsable = yes  writable = yes  guest ok = yes  read only = no  create mode = 0777   directory mode 0777 

I have access to the windows files when I go to the mounted partition by /media/pp/Acer/Windows, but I get the mentioned error when trying (on the same PC!) to open the Network/WORKGROUP/Ubuntu//WindowsAcer2 shared file Anybody can help me on this one?

Cannot modify some files on samba share

I’m trying to set up a very simple samba configuration, in which a single user (the owner of the share) has full access to the share, and other users have only read access. The following is the smb.conf:

[global] security = user workgroup = WORKGROUP server string = Samba Server %v encrypt passwords = yes log file = /var/log/samba/log.%m max log size = 50  create mask = 644 force create mode = 644 directory mask = 755 force directory mode = 755  [test] comment = Test path = /admin/test writeable = yes browseable = yes 

I can create and modify files from windows without problems most of the time, but some applications add extended ACL when saving files (like MS Word for example), and afterwards I can’t modify or overwrite those files, but oddly enough I can delete them.

root@vsapdes:/admin/test=>ls -l total 16 -rw-r--r--  1 usrcap usr     4 Jun 27 12:59 notepad_file_no_acl.txt -rw-r--r--+ 1 usrcap usr 11256 Jun 27  2019 word_file_with_acl.docx root@vsapdes:/admin/test=>aclget word_file_with_acl.docx * * ACL_type   AIXC * attributes: base permissions     owner(usrcap):  rw-     group(usr):  r--     others:  r-- extended permissions     enabled     specify  r--     g:usr     specify  rw-     u:usrcap 

The samba server is version 4.9.3 and is running on AIX 7.1 in case that has anything to do with the problem (I can modify the file from the terminal with the same user I login into samba with, so I don’t think thats the case).

Samba error: reply_trans: invalid trans parameters

I’m trying to enable folder sharing through samba on my ubuntu 18.04 server;

What I already did:

  1. Edit the /etc/samba/smb.conf as in follow
[global] workgroup = WORKGROUP interfaces = lo eth0 server role = standalone server server string = Samba Server %v security = user map to guest = bad user name resolve order = bcast host dns proxy = no bind interfaces only = yes log file = /var/log/samba/smb.log max log size = 10000  [Public]    path = /samba/share    writable = yes    guest ok = yes    guest only = yes    read only = no    create mode = 0777    directory mode = 0777    force user = nobody 
  1. Run testparm with this result
Load smb config files from /etc/samba/smb.conf rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384) Processing section "[Public]" Loaded services file OK. Server role: ROLE_STANDALONE  Press enter to see a dump of your service definitions  # Global parameters [global]     bind interfaces only = Yes     dns proxy = No     interfaces = lo eth0     log file = /var/log/samba/smb.log     map to guest = Bad User     max log size = 10000     name resolve order = bcast host     security = USER     server role = standalone server     server string = Samba Server %v     idmap config * : backend = tdb   [Public]     create mask = 0777     directory mask = 0777     force user = nobody     guest ok = Yes     guest only = Yes     path = /samba/share     read only = No 
  1. Restart smbd.service
  2. Trying to log on through windows ; windows cannot access \SERVERNAME\…
  3. See errors log
[2019/06/23 21:05:54.565424,  0] ../lib/util/become_daemon.c:124(daemon_ready)   STATUS=daemon 'smbd' finished starting up and ready to serve connections [2019/06/23 21:06:34.482176,  0] ../source3/smbd/ipc.c:843(reply_trans)   reply_trans: invalid trans parameters 

I have been on this for around 5 days, does someone have any clues what’s going on? how to fix this? I just need one public share and another one for restricted access.

Relevance of samba, CTDB and TDB

I use Ubuntu Studio 18.04.2, with the extended support time life through additional PPA backports.

I am a home user. I’m not a programmer and/or network manager. I don’t have any network here. I just use the computer to my personal work (music, audio and MIDI, record, edit and playback).

I wonder the relevance of samba, CTDB and TDB to my personal installation.

Can I uninstall all those apps?