Samba — это бесплатное программное обеспечение, которое обеспечивает взаимодействие между системами Linux/Unix и Windows, позволяя создавать файловые и печатные серверы. Установка сервера Samba на Windows Server 2019 полезна, когда необходимо предоставить доступ к файлам и папкам на сервере с другого сервера на Windows Server 2019. В этой статье мы предоставим шаги по установке сервера Samba на Windows Server 2019 через Server Manager и подключению к нему с другого сервера на Windows Server 2019.
Шаг 1: Установка сервера Samba на Windows Server 2019
Чтобы установить сервер Samba на Windows Server 2019, выполните следующие действия:
Запустите Server Manager и нажмите «Добавить роли и компоненты».
Нажмите «Далее» до страницы «Роли сервера».
Выберите «Сервисы файлов и хранилищ» и нажмите «Далее».
Выберите «Сервисы файлов и iSCSI» и нажмите «Далее».
Если они не выбраны, выберите «Сервер для NFS» и «Поддержка SMB 1.0/CIFS для обмена файлами» и нажмите «Далее».
Нажмите «Установить», чтобы установить выбранные роли и компоненты.
После завершения установки перезагрузите сервер.
Шаг 2: Настройка сервера Samba на Windows Server 2019
После установки сервера Samba выполните следующие действия для его настройки:
Откройте Server Manager и выберите «File and Storage Services».
Выберите «SMB Server» и в окне настройки выберите «Create a fale share, start the new SMB share» и введите имя разделяемой папки.
Выберите SMB hare — Quick
Укажите папку, которую вы хотите разделить.
Нажмите «Далее» и выберите имя папки.
Проверьте настройки и нажмите «Создать».
Перезагрузите сервер.
Шаг 3: Подключение к серверу Samba с другого сервера на Windows Server 2019
После установки и настройки сервера Samba на Windows Server 2019 выполните следующие действия, чтобы подключиться к нему с другого сервера на Windows Server 2019:
-
На сервере, с которого вы хотите подключиться к серверу Samba, откройте проводник Windows и выберите «Этот компьютер».
-
Нажмите «Сеть» в левой панели, чтобы открыть доступные сетевые ресурсы.
-
Найдите сервер Samba в списке и дважды щелкните на нем, чтобы открыть доступные разделяемые папки.
-
Выберите нужную папку и нажмите «Подключиться», чтобы подключиться к серверу Samba.
-
Введите имя пользователя и пароль для доступа к папке, если это необходимо.
-
После успешного подключения вы сможете просматривать и работать с файлами в разделяемой папке на сервере Samba.
В заключение, установка сервера Samba на Windows Server 2019 через Server Manager и подключение к нему с другого сервера на Windows Server 2019 может показаться сложной задачей для новичков, но выполнение приведенных выше шагов поможет вам успешно установить и настроить сервер Samba, чтобы подключиться к нему с другого сервера и использовать его в качестве файлового и печатного сервера в вашей сети.
Также предлагаем рассмотреть другие полезные статьи:
- Как попасть в phpMyAdmin из популярных панелей управления сервером
- Как поднять OpenSSH на Windows 2012
- Как поднять Samba сервер на Linux и подключиться к нему из Windows Server 2019
Модераторы: SLEDopit, Модераторы разделов
-
technotrance
- Сообщения: 280
- ОС: Fedora, FreeBSD, CentOS, Debian
- Контактная информация:
Samba 4. Доступ в шару из Windows 2019 без пароля. [решено]
Всем здравствуйте!
Вроде задача совсем простая, но уже битый день бьюсь над ней.
Есть Самба сервер 4.5.16 на Дебиан 9 с простейшим конфигом:
Код: Выделить всё
[global]
log file = /var/log/samba/log.%m
netbios name = DEBIAN
server string = Samba Server
workgroup = WORKGROUP
interfaces = enp5s0 lo
hosts allow = 127.0.0.1 192.168.
encrypt passwords = yes
security = user
max log size = 50
server multi channel support = yes
server min protocol = SMB3_00
map to guest = Bad Password
[disk]
path = /disk
read only = no
browseable = yes
directory mask = 0770
create mask = 0660
# valid users = admo
acl allow execute always = True
guest ok = yes
public = yes
writeable = yes
Требуется, чтобы в шару был доступ без пароля. Захожу из-под Windows 8.1 — работает. Захожу из-под Windows srv 2019 — не работает. Обе винды имеют настройки «из коробки», т.е. установлены с нуля без всяких изменений в системе.
В 2019 пробовал поменять модель сетевого доступа на гостевую — не помогло.
Если закомментировать строчку:
То при подключении начинает запрашивать логин-пароль. Ну и после его ввода нормально заходит в шару. Но требуется заходить без логина и пароля.
Может кто настраивал такую задачу и поделится своим конфигом для Самбы?
Последний раз редактировалось technotrance 09.11.2021 10:52, всего редактировалось 1 раз.
-
Zer0
- Сообщения: 479
- ОС: Void, Slackware
Re: Samba 4. Доступ в шару из Windows 2019 без пароля.
Сообщение
Zer0 »
Взял из офицальной документации.
Код: Выделить всё
Creating a Basic guest only smb.conf File
The following is a minimal configuration for a Samba standalone server that only allows guest access:
[global]
map to guest = Bad User
log file = /var/log/samba/%m
log level = 1
server role = standalone server
[guest]
# This share allows anonymous (guest) access
# without authentication!
path = /srv/samba/guest/
read only = no
guest ok = yes
guest only = yes
Memento mori … сделай бэкап.
-
technotrance
- Сообщения: 280
- ОС: Fedora, FreeBSD, CentOS, Debian
- Контактная информация:
Re: Samba 4. Доступ в шару из Windows 2019 без пароля.
Сообщение
technotrance »
Нет. Так не работает. Из win srv 2019 не пускает. Конфиг максимально упростил:
Код: Выделить всё
[global]
log file = /var/log/samba/log.%m
# smb passwd file = /etc/samba/smbpasswd
# netbios name = DEBIAN
server string = Samba Server
# workgroup = WORKGROUP
interfaces = enp5s0 lo
hosts allow = 127.0.0.1 192.168.
# encrypt passwords = yes
# security = user
max log size = 50
server multi channel support = yes
server min protocol = SMB3_00
map to guest = Bad User
server role = standalone server
[disk]
path = /disk
read only = no
# browseable = yes
# directory mask = 0770
# create mask = 0660
# valid users = admo
# acl allow execute always = True
guest ok = yes
guest only = yes
# public = yes
# writeable = yes
Есть даже подозрение, что дело не в самбе, а в самой винде, т.к. из той же win8.1 в шару заходит.
Добавлено (10:43):
А, ну понятно… Ответ лежал на поверхности в той же документации:
Начиная с Windows 10 1709, гостевой доступ в SMB2 и SMB3 отключен по умолчанию. Это означает, что гостевой доступ из Windows 10 к общему ресурсу Samba не будет работать
Венду надо копать значит…
Добавлено (10:51):
Всё, вопрос решён, ответ был тут:
https://docs.microsoft.com/en-us/troubleshoot/windows-server/networking/guest-access-in-smb2-is-disabled-by-default
В Windows 10 1709, Windows 10 1803, Windows 10 1903, Windows 10 1909 и Windows Server 2019 гостевая проверка подлинности отключена, если существует AllowInsecureGuestAuth со значением 0 в [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters] AllowInsecureGuestAuth.
Поменял этот параметр на 1.
-
Zer0
- Сообщения: 479
- ОС: Void, Slackware
Re: Samba 4. Доступ в шару из Windows 2019 без пароля.
Сообщение
Zer0 »
Я вот такой финт применяю:
Код: Выделить всё
@Echo Off
echo.
net use z: \\IP.AD.DR.ES\share /user:vasya passwd
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\##IP.AD.DR.ES#share /v _LabelFromReg /t REG_SZ /d "SHARE_ON_IPADDRES" /f
echo.
echo Off
, где IP.AD.DR.ES — ip вашего сервера самбы, share — имя шары, vasya — логин, passwd — пароль.
Всё это в текстовый файл с расширением cmd — и в автозагрузку.
В результате работы скрипта, в винде появится диск Z с названием SHARE_ON_IPADDRES.
Memento mori … сделай бэкап.
Adding a Windows 2019 DC to Your Samba Domain
In this document MSAD 2016 or 2019 joins a Samba-AD with version 4.15.
This documentation is intended for system administrators that need an MS-AD domain controller in their Samba-AD domain for technical reasons (Azure-Sync, etc.).
❗Hint
Since version 4.12, Samba-AD manages a 2012R2 schema level but still with a functional level in 2008R2. It is therefore possible to join a Windows Server 2012R2 configured in 2008R2 functional level with a Samba-AD domain as an AD.
✅Important
Since version 4.12, Samba-AD manages a 2012R2 schema level but still with a functional level in 2008R2. It is therefore possible to join a Windows Server 2012R2 configured in 2008R2 functional level with a Samba-AD domain as an AD.
Microsoft Active Directory 2019
Preparing your Samba-AD for the future junction
- Backup the Samba-AD because irreversible changes will be made;
- Upgrade Samba to its latest 4.15 version;
- Install the required dependencies to join the Windows Server:
# RedHat8 and derived distributions
yum install python3-markdown
# Debian
apt install python3-markdown
Enter fullscreen mode
Exit fullscreen mode
- Then run the following commands, these will join the MS Server 2019 in your domain:
samba-tool domain schemaupgrade
samba-tool domain functionalprep --function-level=2012_R2 --forest-prep --domain-prep
Enter fullscreen mode
Exit fullscreen mode
- Set schema version to 2019
priv=$(smbd -b | grep -i private_dir | cut -d : -f 2 | xargs)
defaultNamingContext=$(ldbsearch -H ldap://127.0.0.1 -s base -b "" defaultNamingContext | grep defaultNamingContext | cut -d : -f 2 | xargs)
schemaNamingContext=$(ldbsearch -H ldap://127.0.0.1 -s base -b "" schemaNamingContext | grep schema | cut -d : -f 2 | xargs)
ldbedit -e "sed -i 's/objectVersion:.*/objectVersion: 88/g'" -H $priv/sam.ldb '(objectClass=dMD)' -b $schemaNamingContext
Enter fullscreen mode
Exit fullscreen mode
- Check the directory database:
samba-tool dbcheck --cross-ncs --fix --yes --reset-well-known-acls
Enter fullscreen mode
Exit fullscreen mode
☑️Note
It is possible that errors appear when launching the command the first time, just run it a second time.
- Enable schema updates in Samba AD:
if grep -q "dsdb:schema update allowed" /etc/samba/smb.conf; then
sed -i '/dsdb:schema update allowed=true/d' /etc/samba/smb.conf
fi
sed -i '/global/a dsdb:schema update allowed=true' /etc/samba/smb.conf
systemctl restart samba-ad-dc
Enter fullscreen mode
Exit fullscreen mode
Preparing and joining the Microsoft Active Directory 2019
☑️Note
It is recommended to use an English version of Windows Server for infrastructure services. This allows you to have logs in English and feel less lonely when searching on the Internet.
-
If not already done, set the server to a fixed IP and configure the DNS redirector to point to the main AD;
-
Force the activation of the Sysvol directory on the MS-AD:
Set-ItemProperty -Path "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters" -Name "SysVolReady" -Value 0
Restart-Computer
Enter fullscreen mode
Exit fullscreen mode
- Install the Active Directory components. In a PowerShell console run the following commands:
Install-WindowsFeature AD-Domain-Services
Add-WindowsFeature RSAT-ADLDS
Add-WindowsFeature RSAT-ADDS-Tools
Add-WindowsFeature RSAT-DNS-Server
Add-WindowsFeature RSAT-DFS-Mgmt-Con
Add-WindowsFeature GPMC
Enter fullscreen mode
Exit fullscreen mode
- Now that the role is installed, promote the server to AD and set it up;
☑️Note
The following command will open a popup that will ask for the Domain Admins credentials to join the server (in graphical mode), then the credentials for the AD restore mode (in text mode).
☑️Note
- If not already done, synchronize the time between MS-AD domain controller in their Samba-AD domain with the following command:
w32tm /config /syncfromflags:manual /manualpeerlist:”NTP Server” /reliable:yes /update
w32tm /resync /force
Enter fullscreen mode
Exit fullscreen mode
☑️Note
Of course modify the values Credential, DomainName, SiteName and ReplicationSourceDC.
There is a back quote character at the end of each line. Do not remove it or PowerShell will interpret this command as multiple commands.
Install-ADDSDomainController `
-Credential (Get-Credential "MIGRATE\Administrator") `
-DomainName 'migrate.lab' `
-SiteName 'Default-First-Site-Name' `
-ReplicationSourceDC smb-adds01.migrate.lab `
-CreateDnsDelegation:$false `
-DatabasePath 'C:\Windows\NTDS' `
-InstallDns:$true `
-LogPath 'C:\Windows\NTDS' `
-NoGlobalCatalog:$false `
-SysvolPath 'C:\Windows\SYSVOL' `
-NoRebootOnCompletion:$true `
-Force:$true
Restart-Computer
Enter fullscreen mode
Exit fullscreen mode
☑️Note
At this stage, the Windows Active Directory is properly attached to the domain. However, some options need to be adjusted on the sysvol, DNS and NTP parts.
- Force the activation of the Sysvol directory on the MS-AD:
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters" -Name "SysvolReady" -Value "1"
Enter fullscreen mode
Exit fullscreen mode
-
Copy the contents of the
SYSVOL
from the Samba-AD server. To do this, in a file explorer, type\\srvads\\sysvol
, then go to the folder corresponding to your domain name (for example ad.mydomain.lan) and copyPolicies
andScripts
intoC:windowsSYSVOLdomain
(but not the domain name). After the copy we will have these two directories:- C:windowsSYSVOLdomainPolicies;
- C:windowsSYSVOLdomainScripts;
⚠️Warning
Samba does not support DFS-R or FRS protocols.
Therefore, it will be necessary to manually synchronize the SYSVOL
directory each time a GPO is created or modified.
☑️Note
There is a link from C:\windows\SYSVOL\sysvol\ad.mydomain.lan
to C:\windows\SYSVOL\domain
.
- Restart the MS-AD server:
shutdown -r -t 0
Enter fullscreen mode
Exit fullscreen mode
-
Reverse DNS servers on the network card. The primary DNS server must be itself (
127.0.0.1
), and the secondary DNS server is the Samba-AD server (Microsoft does the opposite when joining) -
In the DNS console, change the DNS redirector to the network recursor (by default Windows sets the first domain controller as the recursor when joining).
-
The change the NTP configuration in the MS-AD registry:
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Parameters" -Name "Type" -Value "NTP"
Enter fullscreen mode
Exit fullscreen mode
- Then restart the NTP service with a command prompt on the MS-AD server:
net stop w32time
net start w32time
Enter fullscreen mode
Exit fullscreen mode
- Finally, update the DNS and Kerberos configuration of the Samba-AD server by updating the information about the new Windows server. To do this, modify the files
/etc/hosts
,/etc/resolv.conf
and/etc/krb5.conf
;
Final Checks
- Check the directory database in Samba-AD server:
samba-tool dbcheck --cross-ncs --fix --yes --reset-well-known-acls
Enter fullscreen mode
Exit fullscreen mode
- Does Windows Server 2019 support SMB2?
- How do I enable SMB 1 server 2019?
- Is SMB enabled on server 2019?
- What version of SMB does Windows Server 2019 use?
- How do I enable Samba?
- How do I create a shared file in Windows Server 2019?
- What is the difference between SMB and Samba?
Does Windows Server 2019 support SMB2?
Thanks for your update. Guest access in SMB2 will be disabled by default in Windows Server 2019. Note: By enabling insecure guest logons, this setting reduces the security of Windows clients.
How do I enable SMB 1 server 2019?
Under Control Panel Home, select Turn Windows features on or off to open the Windows Features box. In the Windows Features box, scroll down the list, clear the check box for SMB 1.0/CIFS File Sharing Support and select OK. After Windows applies the change, on the confirmation page, select Restart now.
Is SMB enabled on server 2019?
Enable/Disable SMB 1.0 on Windows Server 2016/2019
In Windows Server 2016 starting with build 1709 and Windows Server 2019, SMBv1 is disabled by default. To enable support for the SMBv1 client protocol in newer versions of Windows Server, you need to install the separate SMB 1.0/CIFS File Sharing Support feature.
What version of SMB does Windows Server 2019 use?
This topic describes the SMB 3 feature in Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, and Windows Server 2012—practical uses for the feature, the most significant new or updated functionality in this version compared to previous versions, and the hardware requirements.
How do I enable Samba?
Enabling SMB Signing
To start, open the Group Policy Management tool, this can be done either through Server Manager > Tools > Group Policy Management or by running ‘gpmc. msc’ in PowerShell or Command Prompt. Then, depending upon your preferences, either create a new Group Policy or edit an existing one.
How do I create a shared file in Windows Server 2019?
Right-Click the Folder you’d like to set Sharing and Open [Properties]. Next, move to [Sharing] tab and Click [Advanced Sharing] button. Check a box [Share this folder] and input any Share name you like on [Share name] field. Next, Click [Permissions] button.
What is the difference between SMB and Samba?
Samba is a free software re-implementation of the SMB networking protocol, and was originally developed by Andrew Tridgell. … The name Samba comes from SMB (Server Message Block), the name of the proprietary protocol used by the Microsoft Windows network file system.
I realize this is not a very exciting post, especially compared to my other wonderful musing on this site, but I felt I really had to write it to share the pain!
A colleague I work with needed to enable this feature on an Azure Windows Server 2019 machine to communicate with some old system that only supports Server Message Block version 1 (SMB1). Easy enough to add that right?
Trying the installation
Let’s first get some information about the feature:
Get-WindowsOptionalFeature -Online -FeatureName SMB1Protocol
The output:
Notice the State property? The feature is disabled and the payload (installation files) are not on the Azure virtual machine.
When you try to install the feature, you get:
I guess I need the Windows Server 2019 sources!
Downloading Windows Server 2019
I downloaded Windows Server 2019 (November 2019 version) from https://my.visualstudio.com/Downloads?q=SQL%20Server%202019. I am not sure if you can use the evaluation version of Windows Server 2019 because I did not try that. I downloaded the ISO to the Azure virtual machine.
Mount ISO and copy install.wim
On recent versions of Windows, you can right click an ISO and mount it. In the mounted ISO, search for install.wim and copy that file to a folder on your C: disk like c:\wim. Under c:\wim, create a folder called mount and run the following command:
dism /mount-wim /wimfile:c:\wim\install.wim /index:4 /mountdir:c:\wim\mount /readonly
The contents of install.wim is now available in c:\wim\mount. Now don’t try to enable the feature by pointing to the sources with the -source parameter of Enable-WindowsOptionalFeature. It will not work yet!
Patch the mounted files
The Azure Windows Server 2019 image (at time of writing, June 2020) has a cumulative update installed: https://support.microsoft.com/en-us/help/4551853/windows-10-update-kb4551853. For this installatin to work, I needed to download the update from https://www.catalog.update.microsoft.com/home.aspx and put it somewhere like c:\patches.
Now we can update the mounted files offline with the following command:
Dism /Add-Package /Image:"C:\wim\mount" /PackagePath="c:\patches\windows10.0-kb4551853-x64_ce1ea7def481ee2eb8bba6db49ddb42e45cba54f.msu"
It will take a while to update! You need to do this because the files mounted from the downloaded ISO do not match the version of the Windows Server 2019 image. Without this update, the installation of the SMB1 feature will not succeed.
Enable the SMB1 feature
Now we can enable the feature with the following command:
dism /online /Enable-Feature /FeatureName:SMB1Protocol /All /source:c:\wim\mount\windows\winsxs /limitaccess
You will need to reboot. After rebooting, from a PowerShell prompt run the command below to check the installation:
Get-WindowsOptionalFeature -Online -FeatureName SMB1Protocol
The State property should say: Enabled
Conclusion
Something this trivial took me way too long. Is there a simpler way? Let me know! 👍
And by the way, don’t enable SMB1. It’s not secure at all. But in some cases, there’s just no way around it.