S
S
Sergey Poroshenko2016-11-23 12:57:07
bash
Sergey Poroshenko, 2016-11-23 12:57:07

How to show Ubuntu Server where Samba is installed?

Good day gentlemen.
Prompt how to be with samba.
The essence of the problem is that I have to administer a server on ubuntu server 14.04.5 LTS. It has a file washer, virtual machines, and an Internet gateway.
Actually, there were difficulties with file cleaning. All machines (Windows 7) on the network go to it without problems, and the new computer cannot enter the server in any way.
The problem is that the previous admin installed samba not from the repositories, it seems, but collected it manually.
As a result, all the files are in the /usr/local/samba/ folder:

[email protected]:/usr/local/samba# ls
bin  etc  include  lib  private  samba.sh  sbin  share  var

In the etc folder, respectively, the config:
[email protected]:/usr/local/samba# cat etc/smb.conf
[global]

#---------------- Логи
    max log size = 300
    debug level = 1
    log file = /usr/local/samba/var/log.%m

#---------------- Общие настройки
    netbios name = SERVER
    workgroup = DTP

    server string = DTP file server
    time server = True
    wins support = yes
    domain master = yes
    domain logons = yes
    preferred master = yes
    local master = yes
    logon script = %U.bat
    logon home = \\%L\%U\profile
    os level = 34
    max open files = 10000

#---------------- Доступ на общем уровне и права на ресурсы
    hosts allow = 172.16.5.0/255.255.255.0
    valid users = nobody, @smbusers, @smbadmins
    interfaces = 172.16.5.0/24
    bind interfaces only = true
    write list = @smbadmins
    admin users = @smbadmins
    public = no
    writable = no
    guest account = nobody

#----------------- Имена файлов и атрибуты
    dos charset = CP866
    unix charset = UTF-8
    create mask = 0775
    directory mask = 0775
    force create mode = 0775

    unix extensions = no
    wide links = yes

    acl group control = yes
    inherit owner = yes
    inherit permissions = yes
    inherit acls = yes
    acl allow execute always = yes

    passdb backend = smbpasswd

#============================ Share Definitions ==============================

[netlogon]
    path = /usr/local/SAMBA/%S
    browseable = no

[homes]
    comment = Home Directories
    path = /usr/local/SAMBA/homes/%u
    writable = yes
    browseable = no

[scripts]
    comment = Logon scripts
    path = /usr/local/SAMBA/netlogon
    writable = yes
    write list = @smbadmins

[control]
    comment = Server control
    writable = yes
    path = /usr/local/SAMBA/%S
    write list = @smbadmins
    valid users = @smbadmins

#---------------------

[backup]
    comment = System backup
    writable = yes
    path = /usr/local/SAMBA/%S
    write list = @smbadmins

[buffer]
    comment = File trash
    writable = yes
    path = /usr/local/SAMBA/%S
    write list  = @smbusers

[doc]
    comment = Documents
    writable = yes
    path = /usr/local/SAMBA/%S
    write list = @smbdoc

[buhgaltery]
    comment = Buchgaltery
    writable = yes
    path = /usr/local/SAMBA/%S
    valid users = @smbbuhgaltery
    write list = @smbbuhgaltery

[engineer]
    comment = Engineer
    writable = yes
    path = /usr/local/SAMBA/%S
    valid users = @smbengineer
    write list = @smbengineer

[economist]
    comment = Engineer
    writable = yes
    path = /usr/local/SAMBA/%S
    valid users = @smbeconomist
    write list = @smbeconomist

I logically understand that samba has its own users, groups, user passwords, etc. but for example smbpasswd does not start, and says that there is no component:
[email protected]:/usr/local/samba# smbpasswd
smbpasswd: /usr/local/samba/lib/private/libsamba-modules-samba4.so: version `SAMBA_4.3.3' not found (required by /usr/local/samba/lib/libgensec.so.0)
smbpasswd: /usr/local/samba/lib/private/libndr-samba-samba4.so: version `SAMBA_4.3.3' not found (required by /usr/local/samba/lib/libgensec.so.0)
smbpasswd: /usr/local/samba/lib/private/libsamba-debug-samba4.so: version `SAMBA_4.3.3' not found (required by /usr/local/samba/lib/libgensec.so.0)
smbpasswd: /usr/local/samba/lib/private/libauthkrb5-samba4.so: version `SAMBA_4.3.3' not found (required by /usr/local/samba/lib/libgensec.so.0)
smbpasswd: /usr/local/samba/lib/private/libcliauth-samba4.so: version `SAMBA_4.3.3' not found (required by /usr/local/samba/lib/libgensec.so.0)
smbpasswd: /usr/local/samba/lib/private/libasn1util-samba4.so: version `SAMBA_4.3.3' not found (required by /usr/local/samba/lib/libgensec.so.0)
smbpasswd: /usr/local/samba/lib/private/libgenrand-samba4.so: version `SAMBA_4.3.3' not found (required by /usr/local/samba/lib/libgensec.so.0)
smbpasswd: /usr/local/samba/lib/private/libsamba-sockets-samba4.so: version `SAMBA_4.3.3' not found (required by /usr/local/samba/lib/libgensec.so.0)

I wanted to reinstall samba, copied the entire folder to a backup just in case, ran aptitude purge samba, after which aptitude -f install:
[email protected]:/usr/local/samba# aptitude -f install
The following partially installed packages will be configured:
  samba
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 11 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
Setting up samba (2:4.3.11+dfsg-0ubuntu0.14.04.1) ...
smbd start/pre-start, process 5393
start: Job failed to start
invoke-rc.d: initscript samba-ad-dc, action "start" failed.
dpkg: error processing package samba (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 samba
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
Setting up samba (2:4.3.11+dfsg-0ubuntu0.14.04.1) ...
smbd start/running, process 5546
start: Job failed to start
invoke-rc.d: initscript samba-ad-dc, action "start" failed.
dpkg: error processing package samba (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 samba

Actually this error haunts me everywhere. I can't even install webmin because of her.
ps I personally use a debian 7 server with samba at home, there is a path to the config /etc/samba/samba.conf
It is also present on this server, but it is default, so the idea arose that the OS itself does not understand where it has samba installed . And it cannot be removed\installed\configured...
UPD!
Self-assembled manually samba does not start (renamed the folder), samba starts from the repositories.
There were problems with access, which were solved by copying the smbpasswd file from the old samba to the new one.
At the moment smbpasswd works, but samba-tools doesn't:
[email protected]:~# samba-tool group list
Could not find machine account in secrets database: Failed to fetch machine account password for DTP from both secrets.ldb (Could not find entry to match filter: '(&(flatname=DTP)(objectclass=primaryDomain))' base: 'cn=Primary Domains': No such object: (null)) and from /var/lib/samba/private/secrets.tdb: NT_STATUS_CANT_ACCESS_DOMAIN_INFO
ERROR(ldb): uncaught exception - ldb_search: invalid basedn '(null)'
  File "/usr/lib/python2.7/dist-packages/samba/netcmd/__init__.py", line 175, in _run
    return self.run(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/samba/netcmd/group.py", line 316, in run
    attrs=["samaccountname", "grouptype"])

How can I recreate these very secrets.ldb and secrets.tdb in which there are errors?
The win-domain is not used on the network, computers are in the "DTP" workgroup.
Or I don't understand something and samba-tools is applied only for the domain?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
U
Ulrich, 2016-11-23
@webporoh

I had this. See the logs why samba from the repositories does not start. Most likely, the config in /etc/samba is incompatible, or there is no config at all. Well, delete the old samba altogether, since you made a backup

C
CityCat4, 2016-11-23
@CityCat4

This is just an example of what will happen if you start working in a package distribution, as in source-based. Installed bubuntu - forget about building from source!
You will have to solve the problem of manually removing samba (and most likely re-entering the domain) and installing it from packages with appropriately corrected config slipped from the old one.
Samba may not have its own users - if the system is configured to use domain accounts via sssd or via winbindd. Your accounts are hell.
OMG, is she also a domain master? Is she the only domain controller or is there still Windows? If she is the only DC, then you need to be veryBe careful - samba's user base is stored in /var/lib/samba (or something like that, there are a lot of files with .tdb extension). If this database is blown out, all users will lose their RIDs and profiles will no longer be available to them ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question