Ранее (до третьей версии включительно) для реализации данной задачи мы пользовались указанием в секции [global] директивы security = share, а в секции самой шары — просто guest ok = yes и всё работало как надо. Теперь же надо делать чуть-чуть иначе, а именно:
Необходимо использовать директивы security = user и map to guest = Bad Password в секции [global], а так-же указывать guest ok = yes в секции шары.
Дело в том, что директивы security = share|server считаются устаревшими, именно поэтому нам и остается пользоваться security = user. Для отделения же пользователя от гостя применяется новая директива map to guest = Bad Password (смысл которой заключается в том, что если пользователь Samba существует в системе и введен неверный пароль, то вход этого пользователя отклоняется, если пользователя не существует, тогда ему присваивается статус гость). Ну а для того чтобы открыть доступ к общему ресурсу для гостей осталась старая добрая директива guest ok = yes которую необходимо указывать непосредственно в секции шары.
[global]
security = user
workgroup = MYGROUP
server string = Samba
guest account = nobody
map to guest = Bad User
[share]
path = /mnt/files
browseable = Yes
guest ok = Yes
writeable = Yes
public = yes
Далее chmod…..
Только обратите внимание, что эта конфигурация будет нормально работать на Mac и Linux системах, а вот клиенты Windows не смогут туда подключиться — ограничения Windows. Наиболее подходящее решение — организовать доступ по ip или паролю (просто ставите галочку: сохранить пароль)!
Попробуй это братка
_ldap._tcp.au.team. IN SRV 0 100 389 hq-srv2.au.team.
_ldap._tcp.dc._msdcs.au.team. IN SRV 0 100 389 hq-srv2.au.team.
_ldap._tcp.pdc._msdcs.au.team. IN SRV 0 100 389 hq-srv2.au.team.
_kerberos._tcp.au.team. IN SRV 0 100 88 hq-srv2.au.team.
_kerberos._udp.au.team. IN SRV 0 100 88 hq-srv2.au.team.
_kerberos-master._tcp.au.team. IN SRV 0 100 88 hq-srv2.au.team.
_kerberos._tcp.dc._msdcs.au.team. IN SRV 0 100 88 hq-srv2.au.team.
_kerberos._udp.dc._msdcs.au.team. IN SRV 0 100 88 hq-srv2.au.team.
_gc._tcp.au.team. IN SRV 0 100 3268 hq-srv2.au.team.
_kpasswd._tcp.au.team. IN SRV 0 100 464 hq-srv2.au.team.
_kpasswd._udp.au.team. IN SRV 0 100 464 hq-srv2.au.team.
Диагностируй братка
kinit administrator
samba-tool domain info 127.0.0.1
smbclient -L localhost -U administrator
smbclient //localhost/netlogon
samba-tool computer list
wbinfo -g
wbinfo -u
Модераторы: 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 … сделай бэкап.
Здесь приведена простейшая беспарольная конфигурация, с анонимным доступом:
[global] workgroup = WORKGROUP server string = Media Server security = user map to guest = Bad User log file = /var/log/samba/%m.log max log size = 50 guest account = nobody dns proxy = no [share] path = /var/lib/samba/share guest ok = yes public = yes writable = yes available = yes
Директории дать права 0775 и сделать владельцем пользователя nobody, группу nogroup:
sudo chown nobody:nogroup /var/lib/samba/share
sudo chmod 0775 /var/lib/samba/share
На клиенте установить пакет cifs-utils
sudo apt-get install cifs-utils
Выполнить команду монтирования (от имени суперпользователя) с указанием адреса и папки сервера, например:
sudo mount -t cifs //10.0.10.201/share /mnt -o users,sec=none
В случае, если необходим полный доступ к файлам из Windows и Astra Linux, добавить в секцию «share»:
create mask = 0777
directory mask = 0777
force create mode = 777
force directory mode = 777
Setup Passwordless SAMBA Share in Linux for Windows Server Access
In this article, we will perform the required steps to setup Passwordless SAMBA Share on Linux Server. This can permit everyone on a windows machine to get entry to this without a set off for password. This form of requirement generally comes from the Window application team in which they want an application to get access Linux share drive to store/access files/images from the Linux share drive without prompting for a password.
Please note we will be using OEL (Oracle Enterprise Linux) 7.9 & yum and wget command require internet access in your Linux Server.
[root@test-machine01 log]# cat /etc/oracle-release Oracle Linux Server release 7.9
Please verify you have already got the OEL7 yum repository, typically OEL yum repository is configured all through the time of OS installation. Use yum repolist command to list presently configure yum repository in your Server.
[root@test-machine01 log]# yum repolist Loaded plugins: langpacks, ulninfo repo id repo name status !mysql-connectors-community/x86_64 MySQL Connectors Community 175 !mysql-tools-community/x86_64 MySQL Tools Community 120 !mysql80-community/x86_64 MySQL 8.0 Community Server 211 !ol7_UEKR6/x86_64 Latest Unbreakable Enterprise Kernel Release 6 for Oracle Linux 7Server (x86_64) 204 !ol7_latest/x86_64 Oracle Linux 7Server Latest (x86_64) 21,673
For some reason, if you are lacking with OEL7 yum repository file, you may get configured it with wget command.
[root@test-machine01 yum.repos.d]# wget http://yum.oracle.com/public-yum-ol7.repo --2020-12-23 10:14:53-- http://yum.oracle.com/public-yum-ol7.repo Resolving yum.oracle.com (yum.oracle.com)... 104.113.245.169 Connecting to yum.oracle.com (yum.oracle.com)|104.113.245.169|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 16402 (16K) [text/plain] Saving to: âpublic-yum-ol7.repo.1â 100%[====================================================================================================================================================>] 16,402 --.-K/s in 0s 2020-12-23 10:14:54 (106 MB/s) - âpublic-yum-ol7.repo.1â saved [16402/16402]
Install SAMBA software program using under yum install command.
[root@test-machine01 yum.repos.d]# yum install samba Installing : libtalloc-2.1.16-1.el7.x86_64 1/14 Installing : libtdb-1.3.18-1.el7.x86_64 2/14 Installing : libtevent-0.9.39-1.el7.x86_64 3/14 Installing : libldb-1.5.4-1.el7.x86_64 4/14 Installing : samba-common-4.10.16-9.el7_9.noarch 5/14 Installing : libwbclient-4.10.16-9.el7_9.x86_64 6/14 Installing : samba-common-libs-4.10.16-9.el7_9.x86_64 7/14 Installing : samba-client-libs-4.10.16-9.el7_9.x86_64 8/14 Installing : python-tdb-1.3.18-1.el7.x86_64 9/14 Installing : pyldb-1.5.4-1.el7.x86_64 10/14 Installing : pytalloc-2.1.16-1.el7.x86_64 11/14 Installing : samba-libs-4.10.16-9.el7_9.x86_64 12/14 Installing : samba-common-tools-4.10.16-9.el7_9.x86_64 13/14 Installing : samba-4.10.16-9.el7_9.x86_64 14/14 Verifying : samba-libs-4.10.16-9.el7_9.x86_64 1/14 Verifying : samba-client-libs-4.10.16-9.el7_9.x86_64 2/14 Verifying : libldb-1.5.4-1.el7.x86_64 3/14 Verifying : libtevent-0.9.39-1.el7.x86_64 4/14 Verifying : samba-common-tools-4.10.16-9.el7_9.x86_64 5/14 Verifying : samba-common-4.10.16-9.el7_9.noarch 6/14 Verifying : libwbclient-4.10.16-9.el7_9.x86_64 7/14 Verifying : libtalloc-2.1.16-1.el7.x86_64 8/14 Verifying : samba-4.10.16-9.el7_9.x86_64 9/14 Verifying : samba-common-libs-4.10.16-9.el7_9.x86_64 10/14 Verifying : pytalloc-2.1.16-1.el7.x86_64 11/14 Verifying : python-tdb-1.3.18-1.el7.x86_64 12/14 Verifying : pyldb-1.5.4-1.el7.x86_64 13/14 Verifying : libtdb-1.3.18-1.el7.x86_64 14/14 Installed: samba.x86_64 0:4.10.16-9.el7_9 Dependency Installed: libldb.x86_64 0:1.5.4-1.el7 libtalloc.x86_64 0:2.1.16-1.el7 libtdb.x86_64 0:1.3.18-1.el7 libtevent.x86_64 0:0.9.39-1.el7 libwbclient.x86_64 0:4.10.16-9.el7_9 pyldb.x86_64 0:1.5.4-1.el7 pytalloc.x86_64 0:2.1.16-1.el7 python-tdb.x86_64 0:1.3.18-1.el7 samba-client-libs.x86_64 0:4.10.16-9.el7_9 samba-common.noarch 0:4.10.16-9.el7_9 samba-common-libs.x86_64 0:4.10.16-9.el7_9 samba-common-tools.x86_64 0:4.10.16-9.el7_9 samba-libs.x86_64 0:4.10.16-9.el7_9 Complete! [root@test-machine01 yum.repos.d]#
Configure smb service to ON after server reboot and start smb SERVICE.
[root@test-machine01 app_share]# chkconfig smb on Note: Forwarding request to 'systemctl enable smb.service'. Created symlink from /etc/systemd/system/multi-user.target.wants/smb.service to /usr/lib/systemd/system/smb.service. [root@test-machine01 app_share]# service smb start Redirecting to /bin/systemctl start smb.service [root@test-machine01 app_share]# systemctl list-unit-files |grep smb smb.service enabled
Please note we are using file system /u01/app_share for sharing purposes. and application User is appuser, grant vital privileges to application User appuser on /u01/app_share.
[root@test-machine01 app_share]# chown -R appuser:appuser /u01/app_share [root@test-machine01 app_share]# chmod 775 app_share [root@test-machine01 u01]# pwd /u01 [root@test-machine01 u01]# ls -ld app_share drwxrwxr-x. 2 appuser appuser 54 Dec 23 12:43 app_share [root@test-machine01 u01]# chcon -Rt samba_share_t /u01/app_share
Take a backup of smb config file earlier than editing it. Add/modify the below parameters in a samba config file. Please observe dailyreport keyword will be used for accessing the share drive, So you can add your share name as consistent with your requirement. Test if all parameter is valid using testparm command. Once all changes are done restart smb service.
[root@test-machine01 samba]# pwd
/etc/samba
[root@test-machine01 samba]# cp smb.conf smb.conf.backup
[root@test-machine01 samba]# vi smb.conf
[global]
workgroup = <Add your company workgroup name>
netbios name = test-machine01
map to guest = bad user
max protocol = SMB2
[dailyreport]
path = /u01/app_share
browseable = yes
guest ok = yes
guest only = yes
read only = no
force user = appuser
force group = appuser
force create mode = 0777
force directory mode = 0777
[root@test-machine01 samba]# testparm
Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
[root@test-machine01 samba]# service smb restart
Redirecting to /bin/systemctl restart smb.service
Now you can access \\192.168.xxx.xxx\dailyreport from Windows Server and you can use this shared drive to store modify or delete files.
Just to validate, the same files exist in Linux Server under file system /u01/app_share.
[root@test-machine01 app_share]# ls -ltr total 1892 -rwxrwxrwx. 1 appuser appuser 1907863 Jan 13 2016 SQL Example.pdf -rwxrwxrwx. 1 appuser appuser 12115 Jun 7 2020 Jamsher_Test.xlsx -rwxrwxrwx. 1 appuser appuser 47 Dec 23 11:32 Test File.txt
This document is just for learning purpose and always validate in the LAB environment first before applying in the LIVE environment.
Hope so you like this article!
Please share your valuable feedback/comments/subscribe and follow us below and don’t forget to click on the bell icon to get the most recent update. Click here to understand more about our pursuit.
Hello and welcome to DBsGuru,I’m Jamsher Khan working as Senior Oracle DBA based in KSA-Jeddah, I have working experience in Oracle DBA, SQL Server, MySql, PostgreSQL, Linux, Golden Gate, ODA.Thanks for the visits!Share Learn Grow!
