Extraindo diretamente do man:
"DESCRIPTION
The virtual file system, VFS, is the kernel interface to file systems.
The interface specifies the calls for the kernel to access file systems.
It also specifies the core functionality that a file system must provide
to the kernel.
The focus of vfs activity is the vnode and is discussed in vnode(9).
Então, tem quase 1 ano que estou com este draft da vida para ser publicado… Vou escrever enquanto faço um servicinho nada limpo agora
Os objetos VFS (e não VSF) dão uma puta ajuda no Samba. Não tem muito o que falar, TUDO está nas man pages. Vou dar dois exemplos que uso bastante: audit & recycle. No smb.conf feliz, faça:
[global]
; vfs modules
vfs objects = audit, recycle
audit:facility = LOCAL1
audit:priority = NOTICE
recycle:facility = LOCAL1
recycle:priority = NOTICE
recycle:directory_mode = 0770
recycle:keeptree = yes
recycle:versions = yes
; shares
[Agentes]
comment = Agentes de Credito
path = /data/agentes
read only = no
create mask = 0775
directory mask = 0775
user = @agentes
Feito isto, vamos conectar ao compartilhamento:
spoofing@frw:~$ smbclient //10.1.1.2/Agentes -U qualquer
Password:
Domain=[SERVIDOR] OS=[Unix] Server=[Samba 3.0.28]
smb: \> ls
. D 0 Fri Nov 7 04:49:11 2008
.. D 0 Fri Nov 7 04:49:47 2008
45351 blocks of size 4194304. 43083 blocks available
smb: \> put this-is-just-a-modern-rock-song
putting file this-is-just-a-modern-rock-song as \this-is-just-a-modern-rock-song (0.0 kb/s) (average 0.0 kb/s)
smb: \>
No queridasso messages:
Nov 7 06:02:09 frw smbd_audit[32758]: connect to service Agentes by user qualquer
Nov 7 06:02:12 frw smbd_audit[32758]: opendir ./
Nov 7 06:02:19 frw smbd_audit[32758]: opendir .
Nov 7 06:02:19 frw smbd_audit[32758]: open this-is-just-a-modern-rock-song (fd 26) for writing
Nov 7 06:02:19 frw smbd_audit[32758]: fchmod_acl this-is-just-a-modern-rock-song mode 0x1f4 failed: Function not implemented
Nov 7 06:02:19 frw smbd_audit[32758]: close fd 26
É isso que o “audit” faz. Agora, vamos para o recycle. Vamos deletar o arquivo feliz que colocamos, ainda via smbclient:
smb: \> del this-is-just-a-modern-rock-song
smb: \>
E novamente no messages:
Nov 7 06:09:13 frw smbd_audit[32758]: opendir ./
Nov 7 06:09:14 frw smbd_audit[32758]: opendir ./
Nov 7 06:09:14 frw smbd_audit[32758]: chmod_acl .recycle mode 0x1c0 failed: Function not implemented
Nov 7 06:09:14 frw smbd_audit[32758]: unlink ./this-is-just-a-modern-rock-song
Certo, arquivo deletado e somos felizes. Indo até o compartilhamento (caminho real, no file system), teremos o seguinte:
root@frw:/data/agentes# ls -la
total 12
drwxrwxr-x 3 root agentes 512 Nov 7 06:19 .
drwxr-xr-x 7 root wheel 512 Nov 7 04:49 ..
drwxrwx--- 2 qualquer agentes 512 Nov 7 06:19 .recycle
root@frw:/data/agentes# cd .recycle/
root@frw:/data/agentes/.recycle# ls -la
total 8
drwxrwx--- 2 qualquer agentes 512 Nov 7 06:19 .
drwxrwxr-x 3 root agentes 512 Nov 7 06:19 ..
-rwxrw-r-- 1 qualquer agentes 0 Nov 7 06:18 this-is-just-a-modern-rock-song
root@frw:/data/agentes/.recycle#
Lá está o nosso arquivo, até aí tudo bem. E se eu enviar o arquivo novamente, e deletá-lo!? Veja:
smb: \> put this-is-just-a-modern-rock-song
putting file this-is-just-a-modern-rock-song as \this-is-just-a-modern-rock-song (0.0 kb/s) (average 0.0 kb/s)
smb: \> del this-is-just-a-modern-rock-song
smb: \>
...
root@frw:/data/agentes/.recycle# ls -la
total 8
drwxrwx--- 2 qualquer agentes 512 Nov 7 06:22 .
drwxrwxr-x 3 root agentes 512 Nov 7 06:22 ..
-rwxrw-r-- 1 qualquer agentes 0 Nov 7 06:22 Copy #1 of this-is-just-a-modern-rock-song
-rwxrw-r-- 1 qualquer agentes 0 Nov 7 06:18 this-is-just-a-modern-rock-song
root@frw:/data/agentes/.recycle#
Certo também. E se existir algum sub-diretório, etc, como o recycle se comporta!?
smb: \> mkdir diretorio
smb: \> cd diretorio/
smb: \diretorio\> put this-is-just-a-modern-rock-song
putting file this-is-just-a-modern-rock-song as \diretorio\this-is-just-a-modern-rock-song (0.0 kb/s) (average NaN kb/s)
smb: \diretorio\>
...
Nov 7 06:28:16 frw smbd_audit[27327]: opendir ./
Nov 7 06:28:21 frw smbd_audit[27327]: opendir .
Nov 7 06:28:21 frw smbd_audit[27327]: chmod_acl diretorio mode 0x1fd failed: Function not implemented
Nov 7 06:28:21 frw smbd_audit[27327]: mkdir diretorio
Nov 7 06:28:23 frw smbd_audit[27327]: opendir ./
Nov 7 06:28:37 frw smbd_audit[27327]: opendir diretorio
Nov 7 06:28:37 frw smbd_audit[27327]: open diretorio/this-is-just-a-modern-rock-song (fd 26) for writing
Nov 7 06:28:37 frw smbd_audit[27327]: fchmod_acl diretorio/this-is-just-a-modern-rock-song mode 0x1f4 failed: Function not implemented
Nov 7 06:28:37 frw smbd_audit[27327]: close fd 26
...
smb: \diretorio\> del this-is-just-a-modern-rock-song
smb: \diretorio\>
...
root@frw:/data/agentes# ls -la .recycle/
total 12
drwxrwx--- 3 qualquer agentes 512 Nov 7 06:30 .
drwxrwxr-x 4 root agentes 512 Nov 7 06:28 ..
-rwxrw-r-- 1 qualquer agentes 0 Nov 7 06:22 Copy #1 of this-is-just-a-modern-rock-song
drwxrwx--- 2 qualquer agentes 512 Nov 7 06:30 diretorio
-rwxrw-r-- 1 qualquer agentes 0 Nov 7 06:18 this-is-just-a-modern-rock-song
root@frw:/data/agentes# ls -la .recycle/diretorio/
total 8
drwxrwx--- 2 qualquer agentes 512 Nov 7 06:30 .
drwxrwx--- 3 qualquer agentes 512 Nov 7 06:30 ..
-rwxrw-r-- 1 qualquer agentes 0 Nov 7 06:28 this-is-just-a-modern-rock-song
root@frw:/data/agentes#
Legal, né!? Então, dá pra fazer bastante coisa legal com esses módulos. Com algum conhecimento de programação, dá pra fazer alguns hacks mais legais ainda. E não esqueça do apropos vfs.
Posts relacionados:

No comments yet
Deixe Seu Comentário