{"id":673,"date":"2017-09-30T13:00:39","date_gmt":"2017-09-30T12:00:39","guid":{"rendered":"http:\/\/chewett.co.uk\/blog\/?p=673"},"modified":"2019-01-20T23:41:01","modified_gmt":"2019-01-20T23:41:01","slug":"grant-sudo-access-user-raspberry-pi-raspbian","status":"publish","type":"post","link":"https:\/\/chewett.co.uk\/blog\/673\/grant-sudo-access-user-raspberry-pi-raspbian\/","title":{"rendered":"Grant sudo access for a user with Raspberry Pi Raspbian"},"content":{"rendered":"<p>This blog post describes how you can enable sudo for any user on the Raspberry Pi OS, Raspbian.<\/p>\n<p><!--more--><\/p>\n<h2>Why sudo is important<\/h2>\n<p>Sudo is a command that lets you run a command as the &#8220;Super User&#8221;. The super user&#8217;s username is typically root on Linux machines. Instead of logging in as the root user and running your commands it is recommended to use&nbsp;sudo.<\/p>\n<p>There are a number of reasons for this and the primary one is security. Running as root will let you change\/delete any files on the filesystem. There are a lot of files you will not want to edit or remove as doing so would cause issues for the computer. This could be you purposely (and wrongly) modifying files or a program you run accidentally changing them.<\/p>\n<p>In addition to accidental issues, there are also malicious programs to consider. If you run everything as root then anything you run also has these rights. If you accidentally run a malicious script then it will have rights to do anything on your computer unhindered.<\/p>\n<p>Since there will always be times you will want to run something with superuser rights sudo can help. Sudo allows you to run a single or multiple commands as the superuser. Once you have finished running your command with sudo it will return to running as your user.<\/p>\n<p>This means that any commands you need to run as the superuser, you can prefix with <code>sudo<\/code>&nbsp;but otherwise you run as your user. This gives both an appropriate level of security and flexibility with running your computer.<\/p>\n<h2>Adding sudo to a user<\/h2>\n<p>The default <code>pi<\/code>&nbsp;user on Raspbian OS will have been given sudo access. However if you <a href=\"http:\/\/chewett.co.uk\/blog\/409\/setting-raspberry-pi-cluster-node\/\">create a new Linux&nbsp;user on Raspbian<\/a> you may want to give it sudo access.<\/p>\n<p>To allow a user to run sudo on Raspbian OS you can add them to the group <code>sudo<\/code>&nbsp;group. This can be achieved running the following command.<\/p>\n<pre>usermod -aG sudo chewett<\/pre>\n<p>This command requires running as root so you will either need to log in as root or use the pi user.&nbsp; This user is configured by default to have the sudo privilege. You will need to replace <code>chewett<\/code>&nbsp;with the user you want to add sudo privileges&nbsp;to.<\/p>\n<p>Once this has been given to the user you will need to reload the group permissions. This can be done by logging out and back in again.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This blog post describes how you can enable sudo for any user on the Raspberry Pi OS, Raspbian.<\/p>\n","protected":false},"author":1,"featured_media":674,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[122],"tags":[39,37,114,173],"class_list":["post-673","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-raspberry-pi-cluster","tag-linux","tag-raspberry-pi","tag-raspbian","tag-sudo"],"wppr_data":{"cwp_meta_box_check":"No"},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/09\/add_sudo_to_a_user_raspbian.jpg?fit=800%2C800&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p2toWX-aR","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":567,"url":"https:\/\/chewett.co.uk\/blog\/567\/upgrading-raspbian-jessie-raspbian-stretch\/","url_meta":{"origin":673,"position":0},"title":"Upgrading Raspbian Jessie to Raspbian Stretch","author":"Chewett","date":"November 4, 2017","format":false,"excerpt":"This post describes how you can upgrade Raspbian Jessie, version 8, to Raspbian Stretch, version 9. Raspbian Stretch was recently released and while they recommend installing from fresh you are able to upgrade the versions. Here I follow the steps of upgrading the Raspberry Pi's in my cluster including some\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/upgrading_to_raspbian_stretch.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/upgrading_to_raspbian_stretch.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/upgrading_to_raspbian_stretch.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/upgrading_to_raspbian_stretch.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":521,"url":"https:\/\/chewett.co.uk\/blog\/521\/add-new-user-account-raspbian-raspberry-pi\/","url_meta":{"origin":673,"position":1},"title":"Add a new user account in Raspbian Raspberry Pi","author":"Chewett","date":"August 5, 2017","format":false,"excerpt":"For my cluster project I will add a new user to each Raspberry Pi. This is so the user I use for all other systems will be the \u00a0same on the Raspberry Pi's. This post describes how to add another user to Raspbian OS. Adding a new user to Raspbian\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/add_user_to_raspbian_os.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/add_user_to_raspbian_os.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/add_user_to_raspbian_os.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/add_user_to_raspbian_os.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":241,"url":"https:\/\/chewett.co.uk\/blog\/241\/installing-raspbian-onto-raspberry-pi\/","url_meta":{"origin":673,"position":2},"title":"Installing Raspbian onto a Raspberry Pi","author":"Chewett","date":"May 17, 2017","format":false,"excerpt":"Here I suggest some recommended steps to install Raspbian on top of their install guide. Choosing an OS for the Raspberry Pi One of the main ways to install a Raspberry Pi OS is to download a disk image called NOOBS.\u00a0This lets you\u00a0choose to easily install a number of different\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":409,"url":"https:\/\/chewett.co.uk\/blog\/409\/setting-raspberry-pi-cluster-node\/","url_meta":{"origin":673,"position":3},"title":"Setting up a Raspberry Pi Cluster Node","author":"Chewett","date":"August 19, 2017","format":false,"excerpt":"To set up a Raspberry Pi node I will follow a specific set of steps so that every Pi is set up \u00a0similarly. For the initial deployment I will follow this once and then clone the SD Card multiple times. If at a later date more are added I will\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/setting_up_a_raspi_cluster_node.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/setting_up_a_raspi_cluster_node.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/setting_up_a_raspi_cluster_node.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/setting_up_a_raspi_cluster_node.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":461,"url":"https:\/\/chewett.co.uk\/blog\/461\/updating-raspberry-pi-cluster-without-logging-every-pi\/","url_meta":{"origin":673,"position":4},"title":"Updating the Raspberry Pi Cluster without logging in to every Pi","author":"Chewett","date":"July 1, 2017","format":false,"excerpt":"The Raspberry Pi foundation have recently updated their Raspbian image. This brings bugfixes and upgrades to the Raspberry Pi. In this blogpost I share how you can run a command on your Raspberry Pi without logging in (this is mostly true although you still do \"log in\" just not in\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/07\/raspbian_update_command.png?fit=580%2C307&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/07\/raspbian_update_command.png?fit=580%2C307&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/07\/raspbian_update_command.png?fit=580%2C307&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":448,"url":"https:\/\/chewett.co.uk\/blog\/448\/testing-performance-raspberry-pi\/","url_meta":{"origin":673,"position":5},"title":"Testing the performance of a Raspberry Pi","author":"Chewett","date":"July 12, 2017","format":false,"excerpt":"I will be testing the performance of each Raspberry Pi version in my cluster. This is to determine what each one is best suited to running. To do this I need a similar set of tests to run for each and compare them. Ideally the tests will also be runnable\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts\/673","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=673"}],"version-history":[{"count":3,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts\/673\/revisions"}],"predecessor-version":[{"id":1959,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts\/673\/revisions\/1959"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/media\/674"}],"wp:attachment":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=673"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=673"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=673"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}