This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
файловый_сервер_samba [2021/03/01 20:00] val [Настройка samba сервера в режиме DOMAIN/ADS c WINBIND] |
файловый_сервер_samba [2024/10/15 09:52] (current) val [Мониторинг активности пользователей] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Файловый сервер SAMBA ====== | ====== Файловый сервер SAMBA ====== | ||
- | [[http://ru.wikipedia.org/wiki/Samba]] | + | * [[https://ru.wikipedia.org/wiki/Samba|Samba]] |
+ | * [[https://interface31.ru/tech_it/2023/07/vklyuchaem-otobrazhenie-samba-servera-v-setevom-okruzhenii-windows.html|Включаем отображение Samba-сервера в сетевом окружении Windows]] | ||
===== Установка SAMBA ===== | ===== Установка SAMBA ===== | ||
Line 32: | Line 33: | ||
guest ok = Yes | guest ok = Yes | ||
</code><code> | </code><code> | ||
- | server# testparm | + | # mkdir /var/distrs |
- | server# mkdir /var/distrs && chown games /var/distrs | + | # cd /var/distrs |
+ | |||
+ | # wget http://val.bmstu.ru/unix/Mail/Thunderbird%20Setup%2017.0.msi | ||
</code> | </code> | ||
===== Публичный каталог доступный на запись ===== | ===== Публичный каталог доступный на запись ===== | ||
Line 68: | Line 71: | ||
New SMB password: wpassword1 | New SMB password: wpassword1 | ||
- | server# smbpasswd -a user2 | + | server# (echo wpassword2; echo wpassword2) | smbpasswd -a user2 |
# pdbedit -w -L | # pdbedit -w -L | ||
Line 82: | Line 85: | ||
security = user | security = user | ||
[homes] | [homes] | ||
- | read only = no | + | read only = no |
+ | valid users = %S | ||
+ | |||
+ | ; sometimes solves the problem permission deny | ||
+ | ;;;; users = %U | ||
+ | ; force user=%U | ||
[corp_share] | [corp_share] | ||
Line 128: | Line 137: | ||
=== Active Directory === | === Active Directory === | ||
- | == Добавляем пользователя в AD == | ||
<code> | <code> | ||
Login: gatecifs | Login: gatecifs | ||
Line 134: | Line 142: | ||
</code> | </code> | ||
Пароль не меняется и не устаревает | Пароль не меняется и не устаревает | ||
- | |||
- | == Создаем ключ сервиса cifs связывая его с фиктивным пользователем AD == | ||
Устанавливаем Microsoft Windows Support Tools | Устанавливаем Microsoft Windows Support Tools | ||
- | Название сервиса HTTP обязательно заглавными буквами | ||
<code> | <code> | ||
C:\>ktpass -princ cifs/gate.corpX.un@CORPX.UN -mapuser gatecifs -pass 'Pa$$w0rd' -out gatecifs.keytab | C:\>ktpass -princ cifs/gate.corpX.un@CORPX.UN -mapuser gatecifs -pass 'Pa$$w0rd' -out gatecifs.keytab | ||
Line 204: | Line 209: | ||
[homes] | [homes] | ||
; may be need make homedir | ; may be need make homedir | ||
- | read only = no | + | read only = no |
+ | valid users = %S | ||
[corp_share] | [corp_share] | ||
Line 210: | Line 216: | ||
;with winbind | ;with winbind | ||
- | ; valid users = CORPX\user1 CORPX\Administrator CORPX\root games | + | ; valid users = CORPX\user1 CORPX\Administrator CORPX\root |
- | ; valid users = @CORP13\group1 games | + | ; valid users = @CORPX\group1 |
- | ; valid users = "@CORPX\domain users" games | + | ; valid users = "@CORPX\domain users" |
;without winbind, group1 must be master group | ;without winbind, group1 must be master group | ||
Line 243: | Line 249: | ||
===== Отладка ===== | ===== Отладка ===== | ||
+ | |||
+ | * [[https://wiki.samba.org/index.php/Client_specific_logging|Client specific logging]] | ||
<code> | <code> | ||
- | # cat smb.conf | + | # cat /etc/samba/smb.conf |
</code><code> | </code><code> | ||
[global] | [global] | ||
... | ... | ||
- | log level = 2 | + | max log size = 0 |
- | log file = /var/log/samba.log.%m | + | log file = /var/log/samba/log.%I |
- | max log size = 50 | + | log level = 10 |
- | debug timestamp = yes | + | debug pid = yes |
+ | debug uid = yes | ||
+ | debug class = yes | ||
+ | debug hires timestamp = yes | ||
... | ... | ||
</code> | </code> | ||
===== Мониторинг активности пользователей ===== | ===== Мониторинг активности пользователей ===== | ||
+ | |||
+ | <code> | ||
+ | # smbstatus | ||
+ | </code> | ||
* [[https://moiristo.wordpress.com/2009/08/10/samba-logging-user-activity/|Samba: Logging User Activity]] !!! аудит можно настроить глобально или, на конкретном ресурсе !!! | * [[https://moiristo.wordpress.com/2009/08/10/samba-logging-user-activity/|Samba: Logging User Activity]] !!! аудит можно настроить глобально или, на конкретном ресурсе !!! | ||
Line 264: | Line 279: | ||
</code><code> | </code><code> | ||
... | ... | ||
- | vfs objects = full_audit | + | vfs objects = full_audit |
- | full_audit:prefix = %U|%u|%I|%m|%S | + | full_audit:prefix = %U|%u|%I|%m|%S |
- | full_audit:success = unlink open | + | full_audit:success = connect, open, mkdir, rmdir, unlink, write, rename |
- | full_audit:failure = none | + | full_audit:failure = none |
- | full_audit:priority = NOTICE | + | full_audit:priority = NOTICE |
... | ... | ||
</code><code> | </code><code> |