Problema de permissões de arquivo no OS X El Capitan e compartilhamento SMB

Problema de permissões de arquivo no OS X El Capitan e compartilhamento SMB

Desde que atualizamos para o OSX El Capitan, tivemos alguns erros estranhos de permissão de arquivo em nosso servidor SMB.

Temos uma máquina servidor Ubuntu hospedando nossos arquivos de trabalho em uma pasta compartilhada SMB para cada uma de nossas estações de trabalho Mac. Nós usamosGit sobre SMBcomÁrvore de origempara construir nossos sites (conveniente para compartilhar o mesmo banco de dados e arquivos), desde que atualizamos para o OS X El Capitan as permissões de arquivo não são as mesmas e o Git marca todos os arquivos alterados conforme suas permissões mudaram de 0664 para 0775 (ou 0644 para 0755) .

Por exemplo, aqui está a ls -lasaída usando SSH em nosso servidor de desenvolvimento

➜  CashierTheme git:(develop) ls -la
total 72
drwxrwsr-x  9 nestorwww nestorwww  4096 oct.  12 23:42 .
drwxrwsr-x  6 nestorwww nestorwww  4096 avril 14 17:33 ..
-rw-rw-r--  1 nestorwww nestorwww 12261 oct.  12 23:42 CashierThemeApp.php
-rw-rw-r--  1 nestorwww nestorwww    56 oct.  12 23:42 composer.json
-rw-rw-r--  1 nestorwww nestorwww   352 oct.  12 23:42 config.yml
drwxrwsr-x  2 nestorwww nestorwww  4096 oct.  12 23:42 Controllers
-rw-rw-r--  1 nestorwww nestorwww   170 oct.  12 23:42 .editorconfig
drwxrwsr-x  2 nestorwww nestorwww  4096 oct.  12 23:42 Entities
drwxrwsr-x  4 nestorwww nestorwww  4096 oct.  12 23:42 Forms
drwxrwsr-x  8 nestorwww nestorwww  4096 oct.  12 23:42 .git
-rw-rw-r--  1 nestorwww nestorwww    35 oct.  12 23:42 .gitignore
-rw-rw-r--  1 nestorwww nestorwww  1060 oct.  12 23:42 LICENSE.md
-rw-rw-r--  1 nestorwww nestorwww  1819 oct.  12 23:42 README.md
drwxr-sr-x  2 nestorwww nestorwww  4096 oct.  12 23:42 Repositories
drwxrwsr-x  6 nestorwww nestorwww  4096 oct.  12 23:42 Resources
drwxrwsr-x 10 nestorwww nestorwww  4096 oct.  12 23:42 static

As permissões de arquivos estão OK. Então, aqui está o ls -lada nossa pasta de compartilhamento SMB (do meu Mac):

➜  CashierTheme git:(develop) ✗ ls -la
total 328
drwx------  1 ambroisemaupate  staff  16384 12 oct 23:42 .
drwx------  1 ambroisemaupate  staff  16384 14 avr 17:33 ..
-rwx------  1 ambroisemaupate  staff    170 12 oct 23:42 .editorconfig
drwx------  1 ambroisemaupate  staff  16384 12 oct 23:43 .git
-rwx------  1 ambroisemaupate  staff     35 12 oct 23:42 .gitignore
-rwx------  1 ambroisemaupate  staff  12261 12 oct 23:42 CashierThemeApp.php
drwx------  1 ambroisemaupate  staff  16384 12 oct 23:42 Controllers
drwx------  1 ambroisemaupate  staff  16384 12 oct 23:42 Entities
drwx------  1 ambroisemaupate  staff  16384 12 oct 23:42 Forms
-rwx------  1 ambroisemaupate  staff   1060 12 oct 23:42 LICENSE.md
-rwx------  1 ambroisemaupate  staff   1819 12 oct 23:42 README.md
drwx------  1 ambroisemaupate  staff  16384 12 oct 23:42 Repositories
drwx------  1 ambroisemaupate  staff  16384 12 oct 23:42 Resources
-rwx------  1 ambroisemaupate  staff     56 12 oct 23:42 composer.json
-rwx------  1 ambroisemaupate  staff    352 12 oct 23:42 config.yml
drwx------  1 ambroisemaupate  staff  16384 12 oct 23:42 static

Então, quando eu digito o git statuscomando no servidor de desenvolvimento, está tudo bem:

➜  CashierTheme git:(develop) git status
Sur la branche develop
Votre branche est à jour avec 'origin/develop'.

rien à valider, la copie de travail est propre

E… aqui está o git statusresultado do compartilhamento SMB:

➜  CashierTheme git:(develop) ✗ git status
On branch develop
Your branch is up-to-date with 'origin/develop'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   .editorconfig
    modified:   .gitignore
    modified:   CashierThemeApp.php
    modified:   Controllers/ContactController.php
    modified:   Controllers/InvoiceController.php
    modified:   Controllers/PaymentController.php
    modified:   Controllers/PostingController.php
    modified:   Controllers/QuoteController.php
    modified:   Entities/BankOperationTrait.php
    modified:   Entities/Contact.php
    modified:   Entities/Invoice.php
    modified:   Entities/Letter.php
    modified:   Entities/PayableInterface.php
    modified:   Entities/Payment.php
    modified:   Entities/Posting.php
    modified:   Entities/PostingObject.php
    modified:   Entities/Quote.php
    modified:   Forms/ContactSelectorType.php
    modified:   Forms/ContactType.php
    modified:   Forms/DataTransformer/ContactToNumberTransformer.php
    modified:   Forms/Filters/ContactFilterType.php
    modified:   Forms/Filters/PostingFilterType.php
    modified:   Forms/Filters/QuoteFilterType.php
    modified:   Forms/InvoiceStatusType.php
    modified:   Forms/InvoiceType.php
    modified:   Forms/PaymentType.php
    modified:   Forms/PostingObjectType.php
    modified:   Forms/PostingObjectUnitType.php
    modified:   Forms/PostingType.php
    modified:   Forms/QuoteStatusType.php
    modified:   Forms/QuoteType.php
    modified:   LICENSE.md
    modified:   README.md
    modified:   Repositories/PostingRepository.php
    modified:   Resources/config/.gitignore
    modified:   Resources/config/fonts.default.xml
    modified:   Resources/config/pdf_stylesheet.default.xml
    modified:   Resources/firewalled-routes.yml
    modified:   Resources/imports/roles.rzt
    modified:   Resources/imports/settings.rzt
    modified:   Resources/routes.yml
    modified:   Resources/translations/messages.en.xlf
    modified:   Resources/translations/messages.fr.xlf
    modified:   Resources/views/404.html.twig
    modified:   Resources/views/admin/test.html.twig
    modified:   Resources/views/base.html.twig
    modified:   Resources/views/baseAnonymous.html.twig
    modified:   Resources/views/blocks/filters.html.twig
    modified:   Resources/views/blocks/paidtotals.html.twig
    modified:   Resources/views/blocks/totals.html.twig
    modified:   Resources/views/blocks/totals.xml.twig
    modified:   Resources/views/blocks/waitingtotals.html.twig
    modified:   Resources/views/contacts/edit.html.twig
    modified:   Resources/views/contacts/list.html.twig
    modified:   Resources/views/dashboard/list.html.twig
    modified:   Resources/views/forms.html.twig
    modified:   Resources/views/invoices/edit.html.twig
    modified:   Resources/views/invoices/list.html.twig
    modified:   Resources/views/invoices/view.xml.twig
    modified:   Resources/views/modules/navigation-elements.html.twig
    modified:   Resources/views/modules/navigation.html.twig
    modified:   Resources/views/payments/edit.html.twig
    modified:   Resources/views/payments/list.html.twig
    modified:   Resources/views/pdfbase.xml.twig
    modified:   Resources/views/quotes/edit.html.twig
    modified:   Resources/views/quotes/list.html.twig
    modified:   Resources/views/quotes/view.xml.twig
    modified:   Resources/views/tabledforms.html.twig
    modified:   composer.json
    modified:   config.yml
    modified:   static/Gruntfile.js
    modified:   static/bower.json
    modified:   static/css/main.less
    modified:   static/css/normalize.less
    modified:   static/css/postings/commons.less
    modified:   static/css/style.less
    modified:   static/css/style.min.css
    modified:   static/css/vars.less
    modified:   static/css/vendor.less
    modified:   static/css/vendor.min.css
    typechange: static/css/widgets/debugpanel.less
    modified:   static/css/widgets/nav.less
    modified:   static/fonts/fontawesome-webfont.woff2
    modified:   static/js/main.js
    modified:   static/js/vendor/jquery-2.1.3.min.js
    modified:   static/js/vendor/uikit.min.js
    modified:   static/package.json
    modified:   static/public/cashier-theme.08d1e458.min.js
    modified:   static/public/config/assets.config.php
    modified:   static/public/style.7474e8a1.css
    modified:   static/public/vendor-cashier-theme.1a8458ff.min.js
    modified:   static/public/vendor.03b81695.css

no changes added to commit (use "git add" and/or "git commit -a")

Com o git diff:

diff --git a/.editorconfig b/.editorconfig
old mode 100644
new mode 100755
diff --git a/.gitignore b/.gitignore
old mode 100644
new mode 100755
diff --git a/CashierThemeApp.php b/CashierThemeApp.php
old mode 100644
new mode 100755
diff --git a/Controllers/ContactController.php b/Controllers/ContactController.php
old mode 100644
new mode 100755

Etc etc

E por último trecho, aqui está minha configuração de compartilhamento SMB, onde digo explicitamente para usar 0644 para arquivos e 0755 para diretórios.

[DevWebServer]
   path = /var/www
   force group = myuser
   force user = myuser
   browsable = yes
   writeable = yes
   create mask = 0644
   directory mask = 0755
   force create mode = 0644
   force directory mode = 0755
   hide dot files = no
   guest ok = no
   public = no
   veto files = /._*/.DS_Store/.AppleDouble
   delete veto files = yes

Não tivemos nenhum problema antes com o OS X Yosemite.

  • Alguém teve esse problema desde que você atualizou para o OS 10.11?
  • Alguém conhece uma solução alternativa para manter as mesmas permissões do servidor para o compartilhamento SMB?
  • Esqueci algo na minha configuração de compartilhamento SMB?

Para aqueles que se perguntam por que usamos Git em vez de SMB, é porque trabalhamos com muitas pessoas ao mesmo tempo construindo sites. Ter uma cópia de cada um em nossas estações de trabalho seria difícil para sincronizar bancos de dados e arquivos de documentos.

Obrigado pela leitura e pelo seu tempo.

Responder1

Este trabalho para mim

[Shared]
    comment = Folder Shared
    path = /path
    unix extensions = no
    force group = root
    force user = root
    browsable = yes
    writeable = yes
    create mask = 0644
    directory mask = 0755
    force create mode = 0644
    force directory mode = 0755
    hide dot files = no
    guest ok = no
    public = no
    valid users = @users

Responder2

Você também pode tentar usar uma versão recente (4.2 ou posterior) do Samba que suporte SMB2 e habilitevfs_frutana partilha. Isso adicionará suporte à extensão AAPL da Apple para SMB2, que deve funcionar melhor que as extensões Unix para SMB1/CIFS.

Responder3

Este problema ainda persiste após a atualização para o OS X 10.11.1.

Como solução parcial, você pode compartilhar os arquivos usando SSHFS em vez de SMB. O SSHFS preserva as permissões, porém tem várias desvantagens:

  • Problemas quando vários usuários gravam os mesmos arquivos.
  • Não há suporte para atributos estendidos nativos, ACLs etc.
  • Mais lento que SMB.

Veja também a discussão sobre Comunidades de suporte da Apple:https://discussions.apple.com/message/29104711

Responder4

Tente desabilitar as extensões unix usando a seguinte instrução no smb.confarquivo do Ubuntu:

unix extensions = no

Em seguida, reinicie o Samba e veja se o problema persiste.

informação relacionada