{"id":1506,"date":"2013-03-08T18:14:00","date_gmt":"2013-03-08T16:14:00","guid":{"rendered":"http:\/\/raftaman.net\/?p=1506"},"modified":"2021-05-15T11:46:38","modified_gmt":"2021-05-15T09:46:38","slug":"accessing-pl2303-usb-serial-adapter-as-non-root-user","status":"publish","type":"post","link":"https:\/\/possiblelossofprecision.net\/?p=1506","title":{"rendered":"Accessing PL2303 USB serial adapter as non-root user"},"content":{"rendered":"<p>If you plug the PL2303 USB to serial adapter (or any other FTDI-like USB adapter) into your USB port, <a href=\"http:\/\/en.wikipedia.org\/wiki\/Udev\">udev<\/a> creates a <code>\/dev\/ttyUSBX<\/code> device with limited read and write permissions (0660 per default). Usually, only the root user and a specific group can access the device at all . To access the device as a regular user, you can either become a member of that group (distribution specific, <code>dialout<\/code> on fedora) or tell udev to create the device with different read and write permissions.<\/p>\n<h2>Become a member of <code>dialout<\/code><\/h2>\n<p>Simply run<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# usermod -a -G groupname username\r\n<\/pre>\n<p>to add the user <code>username<\/code> to the group <code>groupname<\/code>. To verify, that a certain user is a member of a specific group, you can <code>grep<\/code> the file <code>\/etc\/group<\/code> for a user name<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# grep username \/etc\/group\r\n<\/pre>\n<p>Note that you have to <strong>re-login<\/strong> for this changes to take effect.<\/p>\n<h2>Create the device with different permissions<\/h2>\n<p><strong>Alternatively<\/strong>, you can tell udev to create the <code>\/dev\/ttyUSBX<\/code> device with different read and write permissions. Add a udev rule to <code>\/etc\/udev\/rules.d\/<\/code>, e.g. <code>\/etc\/udev\/rules.d\/85-PL2303SerialPort.rules<\/code> with the following content:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nATTRS{idVendor}==&quot;067b&quot;, ATTRS{idProduct}==&quot;2303&quot;, MODE=&quot;0666&quot;\r\n<\/pre>\n<p>You can get the vendor and product id from <code>lsusb<\/code> or by looking at <code>\/var\/log\/messages<\/code> when you plug in the device.<\/p>\n<p>After saving the new udev rule, tell udev to reload it&#8217;s ruleset<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# udevadm control --reload-rules\r\n<\/pre>\n<p>and <strong>eventually plug in<\/strong> your adapter.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you plug the PL2303 USB to serial adapter (or any other FTDI-like USB adapter) into your USB port, udev creates a \/dev\/ttyUSBX device with limited read and write permissions (0660 per default). Usually, only the root user and a specific group can access the device at all . To access the device as a regular user, you can either&#8230; <a href=\"https:\/\/possiblelossofprecision.net\/?p=1506\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,19],"class_list":["post-1506","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-hardware","tag-udev"],"_links":{"self":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/1506","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1506"}],"version-history":[{"count":13,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/1506\/revisions"}],"predecessor-version":[{"id":2179,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/1506\/revisions\/2179"}],"wp:attachment":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1506"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1506"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1506"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}