{"id":8,"date":"2013-12-19T17:54:00","date_gmt":"2013-12-19T17:54:00","guid":{"rendered":"http:\/\/www.hauweele.net\/~gawen\/blog\/?p=8"},"modified":"2014-05-12T19:31:28","modified_gmt":"2014-05-12T17:31:28","slug":"sane-usb-permissions","status":"publish","type":"post","link":"https:\/\/hauweele.net\/~gawen\/blog\/?p=8","title":{"rendered":"SANE USB permissions"},"content":{"rendered":"<p>Today I had a permission problem with SANE on Linux. SANE stands for\u00a0<span style=\"background-color: white;\">&#8220;Scanner Access Now Easy&#8221;, it<\/span>\u00a0<span style=\"background-color: white;\">provides standardized access to scanner hardware (<\/span><a href=\"http:\/\/www.sane-project.org\/\">http:\/\/www.sane-project.org<\/a>) and t<span style=\"background-color: white;\">his is the most commonly used scanning tool on UNIX\/Linux.<\/span><br \/>\n<span style=\"background-color: white;\"><br \/>\n<\/span><span style=\"background-color: white;\">In my case t<\/span>he USB scanner was not recognized when issuing <i>scanimage -L<\/i>\u00a0from my user account\u00a0although it worked correctly under root and my user is in the scanner group. What more is\u00a0<i>sane-find-scanner<\/i>\u00a0reported permissions errors while running the command as user. The owner and group for the device (in my case it was <i>\/dev\/bus\/usb\/002\/004<\/i>) were root:root. At this point we already know that something weird is happening and I expected something like root:scanner instead.<\/p>\n<p>Looking into <i>\/lib\/udev\/rules.d\/60-libsane.rules<\/i>, the line in charge of changing the permissions for each scanner device matched by SANE:<\/p>\n<pre>ENV{libsane_matched}==\"yes\", RUN+=\"\/bin\/setfacl -m g:scanner:rw $env{DEVNAME}\"<\/pre>\n<div>\n<p>This is nice but I do not use ACL and they are disabled in kernel, \u00a0so this command is useless. So I replaced this line with:<\/p>\n<pre>ENV{libsane_matched}==\"yes\", RUN+=\"\/bin\/setfacl -m g:scanner:rw $env{DEVNAME}\", MODE=\"0664\", GROUP=\"scanner\"<\/pre>\n<p>Now the owner and group are correctly set to root:scanner and I can use my scanner as a regular user.<\/p>\n<p>Note that on my system the <i>libsane<\/i>, <i>sane-utils<\/i> and <i>xsane<\/i>\u00a0are the only packages depending on the <i>acl<\/i> package. According to what I&#8217;ve seen in the ChangeLog they do so in order to cope with MFP which I presume should be accessible as a scanner and printer device at the same time. What I would have done instead would be to create special group for MFP devices and use this instead. IMO still less of a mess than enabling ACL on the whole system for a single package.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Today I had a permission problem with SANE on Linux. SANE stands for\u00a0&#8220;Scanner Access Now Easy&#8221;, it\u00a0provides standardized access to scanner hardware (http:\/\/www.sane-project.org) and this is the most commonly used scanning tool on UNIX\/Linux. In my case the USB scanner &hellip; <a href=\"https:\/\/hauweele.net\/~gawen\/blog\/?p=8\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[9,7,8,6,3,2,4,5,12,10,11],"class_list":["post-8","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-acl","tag-debian","tag-libsane","tag-linux","tag-permission","tag-rules","tag-sane","tag-scanner","tag-setfacl","tag-udev","tag-usb"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/posts\/8","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8"}],"version-history":[{"count":0,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/posts\/8\/revisions"}],"wp:attachment":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}