由于我们升级到OSX El Capitan,我们在SMB服务器上遇到了一些奇怪的文件权限错误。
我们有一台Ubuntu服务器机器,通过SMB共享文件夹将我们的工作文件托pipe到我们的每个Mac工作站。 我们使用Git通过 SourceTree来构build我们的网站(方便共享相同的数据库和文件),因为我们升级到OS X El Capitan,文件权限不一样,Git标记每个文件都改变了,因为它们的perms从0664切换到0775(或0644至0755)。
例如,这里是在我们的开发服务器上使用SSH的ls -la输出
➜ 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
文件权限是确定的。 然后,这里是我们的SMB共享文件夹(从我的Mac)的ls -la :
➜ 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
所以当我在dev服务器上inputgit status命令时,一切正常:
➜ CashierTheme git:(develop) git status Sur la branche develop Votre branche est à jour avec 'origin/develop'. rien à valider, la copie de travail est propre
而且…这里是SMB共享的git status输出:
➜ 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")
用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
等等
和最后一个片段,这是我的SMB共享configuration,我明确告诉使用0644文件和0755目录。
[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
我们之前没有任何问题与OS X优胜美地。
对于那些想知道我们为什么使用Git而不是SMB的人,那是因为我们和很多人在同一时间build立网站。 在我们的工作站上分别复制数据库和文档文件是一件很痛苦的事情。
感谢您的阅读和您的时间。
这为我工作
[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
您还可以尝试使用支持SMB2的最新(4.2或更高版本)Samba版本,并在共享上启用vfs_fruit 。 这将增加对苹果SMB2的AAPL扩展的支持,这应该更适合SMB1 / CIFS的Unix扩展。
升级到OS X 10.11.1后,此问题仍然存在。
作为部分解决方法,您可以使用SSHFS而不是SMB共享这些文件。 SSHFS保留权限,但它有几个缺点:
另请参阅有关Apple支持社区的讨论: https : //discussions.apple.com/message/29104711
TL; DR版本:
mount_smbfs -f 0644 -d 0755 //<user@host/share> <share>
长版本:
我知道这个线程是旧的,但这仍然是一个相关的问题。 就我而言,我使用git over CIFS来处理虚拟Linux实例上的远程工作树。 git存储库实际上存在于我的主机系统上,但是我已经在远程系统上签出了。 这样我就可以在使用虚拟机的macOS上开发Linux特定的应用程序,但将git存储库保存在主机中。
无论如何,我遇到了和OP一样的问题。 Git在文件模式下检测到更改,因为共享驱动程序默认创build了具有执行权限的常规文件,所以想要执行具有执行位的文件。 要解决这个问题,我想出了如何使用mount_smbfs命令手动安装共享。 关键选项分别是文件模式和目录模式的-f和-d 。
为了logging,我正在使用macOS 10.11.6“El capitan”。
尝试在Ubuntu的smb.conf文件中使用以下语句禁用unix扩展:
unix extensions = no
然后重新启动Samba,看看问题是否仍然存在。
如果您现在切换到使用您的Apple IDlogin凭据,请将您的用户帐户密码更改为本地密码。 WINS和文件共享不适用于您的iCloudlogin凭据。