{"id":526,"date":"2012-07-30T13:33:52","date_gmt":"2012-07-30T13:33:52","guid":{"rendered":"http:\/\/naich.net\/wordpress\/?p=526"},"modified":"2012-09-11T13:13:31","modified_gmt":"2012-09-11T13:13:31","slug":"another-pi-pun","status":"publish","type":"post","link":"https:\/\/naich.net\/wordpress\/index.php\/another-pi-pun\/","title":{"rendered":"Another pi pun"},"content":{"rendered":"<p><a title=\"Pi Eyed\" href=\"http:\/\/naich.net\/wordpress\/?p=457\">Continued from here<\/a><\/p>\n<p><a title=\"Yummy Pi\" href=\"http:\/\/naich.net\/wordpress\/?p=435\">First page here.<\/a><\/p>\n<h3>6.\u00c2\u00a0 Creating a user<\/h3>\n<p>Now you are starting to get to know your Pi, you&#8217;ll want to start making it feel more like home.\u00c2\u00a0 Unless your name is &#8220;Pi&#8221; you will want to add yourself as a user.\u00c2\u00a0 Type this:<\/p>\n<blockquote>\n<pre>adduser naich<\/pre>\n<\/blockquote>\n<p>Do I really need to explain that you should replace &#8220;naich&#8221; with your name?\u00c2\u00a0 If you&#8217;ve already guessed that and typed it in with your name, you will probably be slightly worried at this point because it will have replied &#8220;adduser: Only root may add a user or group to the system.&#8221;<\/p>\n<p>&#8220;Root&#8221; is the name of the account that has full access to the Linux system.\u00c2\u00a0 There are many things that only Root can do, and it&#8217;s just as well really; one of the things that only root can do is permanently delete the entire filesystem with one command that doesn&#8217;t even bring up an &#8220;Are you sure?&#8221; type question.\u00c2\u00a0 As an ordinary user, you can only screw up your own stuff that you put on there, but as root you are a god that can break everything for everyone forever.\u00c2\u00a0 This is why we try to avoid being root as much as possible.\u00c2\u00a0 Luckily the root password does not actually exist, so you can never log on as root!\u00c2\u00a0 Problem solved, except that sometimes we do want to be able to do rooty stuff, like add users.\u00c2\u00a0 There is a way to temporarily become root and that way is <a href=\"http:\/\/xkcd.com\/149\/\">sudo<\/a>.\u00c2\u00a0 You might remember typing it in earlier.\u00c2\u00a0 Sudo executes a command with root privileges and you simply add &#8220;sudo&#8221; in front of the command you want to run like this: <strong><tt>sudo adduser naich<\/tt><\/strong>:<\/p>\n<blockquote>\n<pre>naich@raspberrypi ~ $ sudo adduser naich\r\nAdding user `naich' ...\r\nAdding new group `naich' (1000) ...\r\nAdding new user `naich' (1000) with group `naich' ...\r\nCreating home directory `\/home\/naich' ...\r\nCopying files from `\/etc\/skel' ...\r\nEnter new UNIX password:<\/pre>\n<\/blockquote>\n<p>Choose a good password for your username but one you will remember.\u00c2\u00a0 Write it down if you have to. \u00c2\u00a0Fill in the rest of the details or leave them blank if you want. \u00c2\u00a0You also need to add your new user to the list of people who can use sudo, so type <strong><tt>sudo visudo<\/tt><\/strong> and you should see this:<\/p>\n<blockquote>\n<pre>#\r\n# This file MUST be edited with the 'visudo' command as root.\r\n#\r\n# Please consider adding local content in \/etc\/sudoers.d\/ instead of\r\n# directly modifying this file.\r\n#\r\n# See the man page for details on how to write a sudoers file.\r\n#\r\nDefaults\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 env_reset\r\nDefaults\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 mail_badpass\r\nDefaults\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 secure_path=\"\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:$\r\n... and so on ...<\/pre>\n<\/blockquote>\n<p>&#8220;visudo&#8221; is the command that allows you to modify the list, &#8220;sudo&#8221; means you are temporarily granted root&#8217;s super powers in order to do so. \u00c2\u00a0What visudo actually does is load a text file into an editor called &#8220;nano&#8221;. \u00c2\u00a0Once nano has loaded the sudoers list, move the cursor down to where it says<\/p>\n<blockquote>\n<pre>pi \u00c2\u00a0ALL=ALL(ALL) NOPASSWD: ALL<\/pre>\n<\/blockquote>\n<p>and change &#8220;pi&#8221; to your new username. \u00c2\u00a0This means &#8220;pi&#8221; will no longer be able to sudo, but that doesn&#8217;t matter because we are going to delete him soon anyway. \u00c2\u00a0To save the changes and exit nano, press CTRL-X. \u00c2\u00a0If you want to exit without saving your changes press N at the prompt, otherwise press Y and then hit return to save it with the suggested name.\u00c2\u00a0 You&#8217;ll be using nano a bit, as most configuration is done with plain text files.<\/p>\n<p>Once you have got back to the &#8220;pi@raspberrypi:~$&#8221; prompt, type <strong><tt>exit<\/tt><\/strong> to log out and log back in again as you.<\/p>\n<h4>6.1 A Windows diversion<\/h4>\n<p>Windows users: this is the part where we sort out the static IP stuff.\u00c2\u00a0 Linux users can skip this bit and go to section 6.2.<\/p>\n<p>You now need to edit two files &#8211; the \/etc\/network\/interfaces file that you couldn&#8217;t edit earlier, and the \/boot\/cmdline.txt file to take out the stuff you put in earlier.\u00c2\u00a0 Type <strong><tt>sudo nano \/etc\/network\/interfaces<\/tt><\/strong> and use the text editor (in the same manner as you did to edit the sudoers file) to edit the file as described in <a title=\"Pi Eyed\" href=\"http:\/\/naich.net\/wordpress\/?p=457\" target=\"_blank\">section 3<\/a> (click to open in a new window\/tab).\u00c2\u00a0 Save it with CTRL-X, [Y]es, Enter and then type <strong><tt>sudo nano \/boot\/cmdline.txt<\/tt><\/strong> and remove all the text after &#8220;rootwait&#8221; that you put in earlier.\u00c2\u00a0 Make sure the text is still all on one line and that there is still a newline at the end of the line.\u00c2\u00a0 Save the file.\u00c2\u00a0 Your Pi is now properly configured with a static IP.<\/p>\n<h4>6.2 Back to our scheduled programming<\/h4>\n<p>Now let&#8217;s kill off &#8220;pi&#8221;.\u00c2\u00a0 If you add users with the command &#8220;adduser&#8221;, you might think you delete them with &#8220;deluser&#8221;, right?\u00c2\u00a0 Nope, it&#8217;s <strong><tt>userdel<\/tt><\/strong>.\u00c2\u00a0 No idea why.\u00c2\u00a0 As a general rule, if you don&#8217;t know what command to use, a good place to start is Google &#8211; &#8220;linux delete user&#8221;, returns 205 million pages telling you how to do it.\u00c2\u00a0 Anyway, have a go at deleting pi.\u00c2\u00a0 I&#8217;m not going to tell you how to do it.\u00c2\u00a0 See if you can guess.<\/p>\n<p>Done it? \u00c2\u00a0It was <strong><tt>sudo userdel pi<\/tt><\/strong>, by the way. \u00c2\u00a0Do you like the way it <em>didn&#8217;t<\/em> ask if you really wanted to do that?\u00c2\u00a0 Linux assumes you know what you are doing and doesn&#8217;t treat you like an idiot by asking you if you really want to do something. \u00c2\u00a0Successful operations for simple things (like copying, moving and deleting files, for example), generally won&#8217;t produce any output unless you tell them to.<\/p>\n<p>If you don&#8217;t know how to navigate the Linux filesystem, <a title=\"Appendixes\" href=\"http:\/\/naich.net\/wordpress\/?p=501\">now is the time to check out Appendix B and learn all about it<\/a>.\u00c2\u00a0 Got it?\u00c2\u00a0 Go to the home directory &#8211; <strong><tt>cd \/home<\/tt><\/strong>\u00c2\u00a0 and have a look &#8211; <strong><tt>ls<\/tt><\/strong> :<\/p>\n<blockquote>\n<pre>naich@raspberrypi ~ $ cd \/home\r\nnaich@raspberrypi \/home $ ls\r\nnaich\u00c2\u00a0 pi\r\nnaich@raspberrypi \/home $<\/pre>\n<\/blockquote>\n<p>As well as your new user&#8217;s directory, there is also one called &#8220;pi&#8221;.\u00c2\u00a0 Although you deleted the user pi you didn&#8217;t delete his stuff.\u00c2\u00a0 You don&#8217;t need or want it, so get rid of it.\u00c2\u00a0 Type <strong><tt>sudo rm -r pi<\/tt><\/strong> (&#8220;rm is short for &#8220;remove&#8221;),&#8230; and it&#8217;s gone.\u00c2\u00a0 As before, there are no prompts, no &#8220;are you sure?&#8221;s; it&#8217;s gone forever.\u00c2\u00a0 If this doesn&#8217;t make you a little uneasy, then you might not have grasped <a href=\"http:\/\/www.youtube.com\/watch?v=D4fzInlyYQo\">how devastating a mistake could be<\/a> and will probably discover this the hard way at some point!<\/p>\n<p>Before you go any further, please consider expanding your knowledge about commands\u00c2\u00a0 a bit by <a href=\"http:\/\/naich.net\/wordpress\/?p=501\">reading appendix C<\/a>.\u00c2\u00a0 You don&#8217;t have to but it might help you understand what&#8217;s going on a bit more. \u00c2\u00a0See if you can find out what the &#8220;-r&#8221; does when you types <strong><tt>sudo rm -r pi<\/tt><\/strong> earlier.<\/p>\n<p><a href=\"http:\/\/naich.net\/wordpress\/?p=563\">Continued here&#8230;<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Continued from here First page here. 6.\u00c2\u00a0 Creating a user Now you are starting to get to know your Pi, you&#8217;ll want to start making it feel more like home.\u00c2\u00a0 Unless your name is &#8220;Pi&#8221; you will want to add yourself as a user.\u00c2\u00a0 Type this: adduser naich Do I really need to explain that [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[74,102],"tags":[],"class_list":["post-526","post","type-post","status-publish","format-standard","hentry","category-geek","category-raspberry-pi"],"_links":{"self":[{"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/526","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=526"}],"version-history":[{"count":26,"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/526\/revisions"}],"predecessor-version":[{"id":827,"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/526\/revisions\/827"}],"wp:attachment":[{"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}