{"id":883,"date":"2011-05-17T13:06:59","date_gmt":"2011-05-17T18:06:59","guid":{"rendered":"http:\/\/www.gamescheat.ca\/?p=883"},"modified":"2019-09-04T19:57:39","modified_gmt":"2019-09-05T00:57:39","slug":"how-to-create-a-new-superuser-in-linux","status":"publish","type":"post","link":"http:\/\/www.gamescheat.ca\/?p=883","title":{"rendered":"How to create a new superuser in Linux"},"content":{"rendered":"<p>The administrative account \u2018root\u2019 is the most powerful user in Linux and Unix.  This account is created by default during installation of the operating system.   Most security consultants will recommend that the root account be deleted or renamed.  This is to make it harder for a hacker to find out what a valid user account is. <\/p>\n<div style=\"float: left;\"><div style=\"margin: 15px 15px 15px 15px\";><script type=\"text\/javascript\"><!--\ngoogle_ad_client = \"pub-3319935785736004\";\ngoogle_alternate_color = \"FFFFFF\";\ngoogle_ad_width = 300;\ngoogle_ad_height = 250;\ngoogle_ad_format = \"300x250_as\";\ngoogle_ad_type = \"text_image\";\ngoogle_ad_channel =\"\";\ngoogle_color_border = \"cccccc\";\ngoogle_color_link = \"cc0000\";\ngoogle_color_bg = \"ffffff\";\ngoogle_color_text = \"000000\";\ngoogle_color_url = \"008000\";\n\/\/--><\/script>\n<script type=\"text\/javascript\"\n  src=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\n<\/script><\/div><\/div><p>Before you delete or rename the root account it is important that you create a new account with the same privileges as root.  This account should have the same capabilities as root, a new superuser account.  I will explain the steps to create a new superuser account in Redhat Linux.  The steps are similar for Centos, Fedora and most other variants of Linux.<\/p>\n<p>Let\u2019s begin by checking the characteristics of the root account.<\/p>\n<blockquote><p># id root<br \/>\nuid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)<\/p>\n<p>uid=0(root), this indicates that root has a user id of 0.<br \/>\ngid=0, the group id is 0.<br \/>\ngroups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel), these are the groups root belongs to.  The numbers signifies the group id numbers, e.g. disk has a group id of 6.<\/p><\/blockquote>\n<p>To create a new superuser, it must have the same uid, gid and belong to the same groups as the root account.<\/p>\n<p>You can create a new superuser account using the adduser command.<\/p>\n<blockquote><p># adduser -u 0 -o -g 0 -G 0,1,2,3,4,6,10 -M andrew<\/p>\n<p>-u 0 \u2013o, this sets the uid to 0.<br \/>\n-g 0, sets the gid to 0.<br \/>\n-G 0,1,2,3,4,6,10, sets the group membership to 0 = root, 1 = bin, 2 = daemon, 3 = sys, 4 = adm, 6 = disk and 10 = wheel.<br \/>\n-M, do not create a home directory.<br \/>\nandrew, new user account name.<\/p><\/blockquote>\n<p>Create a password for the new account.<\/p>\n<blockquote><p># passwd andrew<br \/>\nChanging password for user andrew:<br \/>\nNew UNIX password:<br \/>\nRetype new UNIX password:<br \/>\nPasswd: all authentication tokens updated successfully.<\/p><\/blockquote>\n<p>What if you want to promote an existing user to superuser?  Then you will need to edit two files, \/etc\/passwd and \/etc\/group.<\/p>\n<p>Open \/etc\/passwd with Vi editor and change the gid and uid to 0 for andrew.<\/p>\n<blockquote><p>andrew:x:0:0::\/home\/andrew:\/bin\/bash<\/p><\/blockquote>\n<p>Edit \/etc\/group and add andrew to the groups root, bin, daemon, sys, adm, disk and wheel.<\/p>\n<blockquote><p>root:x:0:root,andrew<br \/>\nbin:x:1:root,bin,daemon,andrew<br \/>\ndaemon:x:2:root,bin,daemon,andrew<br \/>\nsys:x:3:root,bin,adm,andrew<br \/>\nadm:x:4:root,adm,daemon,andrew<br \/>\ndisk:x:6:root,andrew<br \/>\nwheel:x:10:root,andrew<\/p><\/blockquote>\n<p>If the user account andrew has and existing home directory such as \/home\/andrew, then you will need to change the ownership to reflect root. <\/p>\n<blockquote><p># chown root:root \/home\/andrew<\/p><\/blockquote>\n<p>Otherwise you will receive the following error message, upon logging in.<\/p>\n<blockquote><p>User\u2019s $HOME\/.dmrc file is being ignored. This prevents the default session and language from being saved. File should be owned by user and have 644 permission. User $HOME directory must be owned by user and not writable by other users.<\/p><\/blockquote>\n<p>This is because the uid and gid for andrew has been changed to 0, this is the same as root.  Whereas \/home\/andrew still belongs to the username andrew, which had a uid and gid of 500 or higher number.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The administrative account \u2018root\u2019 is the most powerful user in Linux and Unix. This account is created by default during installation of the operating system. Most security consultants will recommend that the root account be deleted or renamed. This is&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/www.gamescheat.ca\/?p=883\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[19],"tags":[55,77,35],"_links":{"self":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts\/883"}],"collection":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=883"}],"version-history":[{"count":1,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts\/883\/revisions"}],"predecessor-version":[{"id":884,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts\/883\/revisions\/884"}],"wp:attachment":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=883"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}