{"id":29133,"date":"2010-10-11T17:25:03","date_gmt":"2010-10-11T17:25:03","guid":{"rendered":"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/unix-sysadmin-boot-camp-user-management\/"},"modified":"2010-10-11T17:25:03","modified_gmt":"2010-10-11T17:25:03","slug":"unix-sysadmin-boot-camp-user-management","status":"publish","type":"post","link":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/planetology\/unix-sysadmin-boot-camp-user-management.php","title":{"rendered":"UNIX Sysadmin Boot Camp: User Management"},"content":{"rendered":"<p><img decoding=\"async\" class=\"profile\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/63a11_rrobson.jpg\" alt=\"Ryan Robson\" style=\"padding-left:10px; padding-right: 10px;\">Now that you&rsquo;re an expert when it comes to <a href=\"http:\/\/blog.theplanet.com\/2010\/05\/26\/unix-sysadmin-boot-camp-bash\/\">bash<\/a>, <a href=\"http:\/\/blog.theplanet.com\/2010\/06\/02\/unix-sysadmin-boot-camp-your-logs-and-you\/\">logs<\/a>, <a href=\"http:\/\/blog.theplanet.com\/2010\/05\/24\/unix-sysadmin-boot-camp-ssh\/\">SSH<\/a>, and <a href=\"http:\/\/blog.theplanet.com\/2010\/06\/07\/unix-sysadmin-boot-camp-passwords\/\">passwords<\/a>, you&rsquo;re probably foaming at the mouth to learn some new skills. While I can&rsquo;t equip you with the &ldquo;nunchuck skills&rdquo; or &ldquo;bowhunting skills&rdquo; <a href=\"http:\/\/www.imdb.com\/title\/tt0374900\/\">Napoleon Dynamite<\/a> reveres, I <em>can<\/em> help you learn some more important &mdash; though admittedly less exotic &mdash; user management skills in UNIX.  <\/p><h3>Root User<\/h3><p>The root user &mdash; also known as the &ldquo;super user&rdquo; &mdash; has absolute control over everything on the server. Nothing is held back, nothing is restricted, and anything can be done. Only the server administrator should have this kind of access to the server, and you can see why. The root user is effectively the server&rsquo;s master, and the server accordingly will acquiesce to its commands. <\/p><p>Broad root access should be avoided for the sake of security. If a program or service needs extensive abilities that are generally reserved for the root user, it&rsquo;s best to grant those abilities on a narrow, as-needed basis.<\/p><h3>Creating New Users<\/h3><p>Because the <a href=\"http:\/\/blog.theplanet.com\/category\/sysadmin-boot-camp\/\">Sysadmin Boot Camp<\/a> series is geared toward server administration from a command-line point of view, that&rsquo;s where we&rsquo;ll be playing today. Tasks like user creation can be performed fairly easily in a control panel environment, but it&rsquo;s always a good idea to know the down-and-dirty methods as a backup.<\/p><p>The <code>useradd<\/code> command is used for adding users from shell. Let&rsquo;s start with an example and dissect the pieces:<\/p><p><code>useradd -c \"admin\" -d \/home\/username -g users\\ -G admin,helpdesk -s\\ \/bin\/bash userid<\/code><\/p><p><strong><code>-c \"admin\"<\/code><\/strong> &ndash; This command adds a comment to the user we&rsquo;re creating. The comment in this case is &ldquo;admin,&rdquo; which may be used to differentiate the user a little more clearly for better user organization.<br><strong><code>-d \/home\/username<\/code><\/strong> &ndash; This block sets the user&rsquo;s home directory. The most common approach is to replace <code>username<\/code> with the username designated at the end of the command.<br><strong><code>-g users\\<\/code><\/strong> &ndash; Here, we&rsquo;re setting the primary group for the user we&rsquo;re creating, which will be <code>users<\/code>.<br><strong><code>-G admin,helpdesk<\/code><\/strong> &ndash; This block specifies other user groups the new user may be a part of.<br><strong><code>-s\\ \/bin\/bash userid<\/code><\/strong> &ndash; This command is in two parts. It says that the new user will use <code>\/bin\/bash<\/code> for its shell and that <code>userid<\/code> will be the new user&rsquo;s username.<\/p><h3>Changing Passwords<\/h3><p>Root is the only user that can change other users&rsquo; passwords. The command to do this is:<\/p><p><code>passwd userid<\/code><\/p><p>If you are a user and want to change your own password, you would simply issue the <code>passwd<\/code> command by itself. When you execute the command, you will be prompted for a new entry. This command can also be executed by the root user to change the root password.<\/p><h3>Deleting Users<\/h3><p>The command for removing users is <code>userdel<\/code>, and if we were to execute the command, it might look like this:<\/p><p><code>userdel -r username<\/code><\/p><p>The <code>&ndash;r<\/code> designation is your choice. If you choose to include it, the command will remove the home directory of the specified user.<\/p><h3>Where User Information is Stored<\/h3><p>The <code>\/etc\/passwd<\/code> file contains all user information. If you want to look through the file one page at a time &mdash; the way you&rsquo;d use <code>\/p<\/code> in Windows &mdash; you can use the <code>more<\/code> command:<\/p><p><code>more \/etc\/passwd<\/code><\/p><p>Keep in mind that most of your important configuration files are going to be located in the <code>\/etc<\/code> folder, commonly spoken with an &ldquo;et-see&rdquo; pronunciation for short.  Each line in the <code>passwd<\/code> file has information on a single user. Arguments are segmented with colons, as seen in the example below:<\/p><p><code>username:password:12345:12345::\/home\/username:\/bin\/bash<\/code> <\/p><p>Argument 1 &ndash; <code>username<\/code> &ndash; the user&rsquo;s username<br>Argument 2 &ndash; <code>password<\/code> &ndash; the user&rsquo;s password<br>Argument 3 &ndash; <code>12345<\/code> &ndash; the user&rsquo;s numeric ID<br>Argument 4 &ndash; <code>12345<\/code> &ndash; the user group&rsquo;s numeric ID<br>Argument 5 &ndash; <code>\"\"<\/code> &ndash; where either a comment or the user&rsquo;s full name would go<br>Argument 6 &ndash; <code>\/home\/username<\/code> &ndash; the user&rsquo;s home directory<br>Argument 7 &ndash; <code>\/bin\/bash<\/code> &ndash; the user&rsquo;s default console shell<\/p><p>Now that you&rsquo;ve gotten a crash course on user management, we&rsquo;ll start going deeper into group management, more detailed permissions management and the way shadow file relates to the <code>passwd<\/code> usage discussed above. <\/p><p>-Ryan<\/p><div><h4>Related Posts:<\/h4><ul><li><a href=\"http:\/\/blog.theplanet.com\/2010\/06\/02\/unix-sysadmin-boot-camp-your-logs-and-you\/\" rel=\"bookmark\">UNIX Sysadmin Boot Camp: Your Logs and You<\/a><\/li><li><a href=\"http:\/\/blog.theplanet.com\/2010\/05\/24\/unix-sysadmin-boot-camp-ssh\/\" rel=\"bookmark\">UNIX Sysadmin Boot Camp: SSH<\/a><\/li><li><a href=\"http:\/\/blog.theplanet.com\/2010\/05\/26\/unix-sysadmin-boot-camp-bash\/\" rel=\"bookmark\">UNIX Sysadmin Boot Camp: bash<\/a><\/li><li><a href=\"http:\/\/blog.theplanet.com\/2009\/05\/26\/mysql-update-from-hidden-select\/\" rel=\"bookmark\">MySQL &ndash; UPDATE from (Hidden) SELECT<\/a><\/li><li><a href=\"http:\/\/blog.theplanet.com\/2010\/02\/11\/how-i-learned-to-stop-worrying-and-love-permissions\/\" rel=\"bookmark\">How I Learned to Stop Worrying and Love Permissions<\/a><\/li><\/ul><\/div><p>\t<a rel=\"nofollow\" href=\"http:\/\/www.stumbleupon.com\/submit?url=http%3A%2F%2Fblog.theplanet.com%2F2010%2F09%2F22%2Funix-sysadmin-boot-camp-user-management%2F&amp;title=UNIX%20Sysadmin%20Boot%20Camp%3A%20User%20Management\" title=\"StumbleUpon\"><img decoding=\"async\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/63a11_stumbleupon.png\" alt=\"StumbleUpon\" class=\"sociable-hovers\" style=\"padding-left:10px; padding-right: 10px;\"><\/a><br>\t<a rel=\"nofollow\" href=\"http:\/\/twitter.com\/home?status=UNIX%20Sysadmin%20Boot%20Camp%3A%20User%20Management%20-%20http%3A%2F%2Fblog.theplanet.com%2F2010%2F09%2F22%2Funix-sysadmin-boot-camp-user-management%2F\" title=\"Twitter\"><img decoding=\"async\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/63a11_twitter.png\" alt=\"Twitter\" class=\"sociable-hovers\" style=\"padding-left:10px; padding-right: 10px;\"><\/a><br>\t<a rel=\"nofollow\" href=\"http:\/\/www.dzone.com\/links\/add.html?url=http%3A%2F%2Fblog.theplanet.com%2F2010%2F09%2F22%2Funix-sysadmin-boot-camp-user-management%2F&amp;title=UNIX%20Sysadmin%20Boot%20Camp%3A%20User%20Management\" title=\"DZone\"><img decoding=\"async\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/63a11_dzone.png\" alt=\"DZone\" class=\"sociable-hovers\" style=\"padding-left:10px; padding-right: 10px;\"><\/a><br>\t<a rel=\"nofollow\" href=\"http:\/\/digg.com\/submit?phase=2&amp;url=http%3A%2F%2Fblog.theplanet.com%2F2010%2F09%2F22%2Funix-sysadmin-boot-camp-user-management%2F&amp;title=UNIX%20Sysadmin%20Boot%20Camp%3A%20User%20Management&amp;bodytext=Now%20that%20you%27re%20an%20expert%20when%20it%20comes%20to%20bash%2C%20logs%2C%20SSH%2C%20and%20passwords%2C%20you%27re%20probably%20foaming%20at%20the%20mouth%20to%20learn%20some%20new%20skills.%20While%20I%20can%27t%20equip%20you%20with%20the%20%22nunchuck%20skills%22%20or%20%22bowhunting%20skills%22%20Napoleon%20Dynamite%20reveres%2C%20I%20can%20help%20\" title=\"Digg\"><img decoding=\"async\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/63a11_digg.png\" alt=\"Digg\" class=\"sociable-hovers\" style=\"padding-left:10px; padding-right: 10px;\"><\/a><br>\t<a rel=\"nofollow\" href=\"http:\/\/delicious.com\/post?url=http%3A%2F%2Fblog.theplanet.com%2F2010%2F09%2F22%2Funix-sysadmin-boot-camp-user-management%2F&amp;title=UNIX%20Sysadmin%20Boot%20Camp%3A%20User%20Management&amp;notes=Now%20that%20you%27re%20an%20expert%20when%20it%20comes%20to%20bash%2C%20logs%2C%20SSH%2C%20and%20passwords%2C%20you%27re%20probably%20foaming%20at%20the%20mouth%20to%20learn%20some%20new%20skills.%20While%20I%20can%27t%20equip%20you%20with%20the%20%22nunchuck%20skills%22%20or%20%22bowhunting%20skills%22%20Napoleon%20Dynamite%20reveres%2C%20I%20can%20help%20\" title=\"del.icio.us\"><img decoding=\"async\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/bd06b_delicious.png\" alt=\"del.icio.us\" class=\"sociable-hovers\" style=\"padding-left:10px; padding-right: 10px;\"><\/a><br>\t<a rel=\"nofollow\" href=\"http:\/\/technorati.com\/faves?add=http%3A%2F%2Fblog.theplanet.com%2F2010%2F09%2F22%2Funix-sysadmin-boot-camp-user-management%2F\" title=\"Technorati\"><img decoding=\"async\" src=\"http:\/\/euvolution.com\/futurist-transhuman-news-blog\/wp-content\/plugins\/wp-o-matic\/cache\/bd06b_technorati.png\" alt=\"Technorati\" class=\"sociable-hovers\" style=\"padding-left:10px; padding-right: 10px;\"><\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>Now that you&rsquo;re an expert when it comes to bash, logs, SSH, and passwords, you&rsquo;re probably foaming at the mouth to learn some new skills. While I can&rsquo;t equip you with the &ldquo;nunchuck skills&rdquo; or &ldquo;bowhunting skills&rdquo; Napoleon Dynamite reveres, &hellip; <a href=\"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/planetology\/unix-sysadmin-boot-camp-user-management.php\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"limit_modified_date":"","last_modified_date":"","_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[34],"tags":[],"class_list":["post-29133","post","type-post","status-publish","format-standard","hentry","category-planetology"],"modified_by":null,"_links":{"self":[{"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/posts\/29133"}],"collection":[{"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/comments?post=29133"}],"version-history":[{"count":0,"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/posts\/29133\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/media?parent=29133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/categories?post=29133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.euvolution.com\/futurist-transhuman-news-blog\/wp-json\/wp\/v2\/tags?post=29133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}