{"id":570,"date":"2012-10-18T13:46:18","date_gmt":"2012-10-18T13:46:18","guid":{"rendered":"https:\/\/raspberry-projects.com\/pi\/?p=570"},"modified":"2015-05-28T14:50:40","modified_gmt":"2015-05-28T14:50:40","slug":"root-user-privileges","status":"publish","type":"post","link":"https:\/\/raspberry-projects.com\/pi\/command-line\/root-user-privileges","title":{"rendered":"Root user privileges"},"content":{"rendered":"<p>\nAfter logging in as user pi, using this command give you root user privileges:\n<\/p>\n<pre>\r\n<code>sudo su<\/code><\/pre>\n<h4>\nExiting root user mode<br \/>\n<\/h4>\n<p>\nUse the exit command:\n<\/p>\n<pre>\r\n<code>exit<\/code><\/pre>\n<p>\nor su username:\n<\/p>\n<pre>\r\n<code>su pi<\/code><\/pre>\n<h4>\nsudo In GUI<br \/>\n<\/h4>\n<p>\nIf you are developing programs which use the IO pin from the GUI you do not have to use &quot;sudo startx&quot; to launch the GUI. Using &quot;sudo .\/myprogram.a&quot; in a LX Terminal window works fine.\n<\/p>\n<h4>\nRunning a command as another user<br \/>\n<\/h4>\n<p>\nIf you are running&nbsp;as the root user (e.g. say within an app called with&nbsp;sudo because you are using the IO pins) you may want to make command lines calls as the standard pi user. &nbsp;You can change to a different user using su &#8211; USERNAME -c before the command and surrounding it with quotes.\n<\/p>\n<pre>\r\n<code>\r\nsu - pi -c \\&quot;fetchmail &gt; \/dev\/null\\&quot;\r\n<\/code><\/pre>\n<h4>\nEnabling The Root Account<br \/>\n<\/h4>\n<p>\nBy default the root account is disabled, but you can enable it by using this command and giving it a password\n<\/p>\n<pre>\r\n<code>\r\nsudo passwd root\r\n<\/code><\/pre>\n<p>\nNow you can log into your pi as the root user. &nbsp;Whilst this opens&nbsp;up security concerns its sometimes very useful, for instance when developing&nbsp;with netbeans and remotely running applicaiotn that access the IO pins.\n<\/p>\n<p>\nIf it doesn&#39;t work&nbsp;check the ssh config\n<\/p>\n<pre>\r\n<code>\r\nsudo nano \/etc\/ssh\/sshd_config\r\n<\/code><\/pre>\n<p>\nSearch for PermitRootLogin and change it to yes\n<\/p>\n<p>\nYou can undo logging in as root again&nbsp;using this command\n<\/p>\n<pre>\r\n<code>\r\nsudo passwd -l root\r\n<\/code><\/pre>\n<p>\n&nbsp;\n<\/p>\n<p>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After logging in as user pi, using this command give you root user privileges: sudo su Exiting root user mode Use the exit command: exit or su username: su pi sudo In GUI If you are developing programs which use the IO pin from the GUI you do not have to use &quot;sudo startx&quot; to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-570","post","type-post","status-publish","format-standard","hentry","category-command-line"],"_links":{"self":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/570","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/comments?post=570"}],"version-history":[{"count":9,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/570\/revisions"}],"predecessor-version":[{"id":1970,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/570\/revisions\/1970"}],"wp:attachment":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/media?parent=570"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/categories?post=570"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/tags?post=570"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}