{"id":19068,"date":"2022-11-23T04:00:33","date_gmt":"2022-11-23T04:00:33","guid":{"rendered":"https:\/\/linuxways.net\/?p=19068"},"modified":"2022-12-20T20:51:04","modified_gmt":"2022-12-20T20:51:04","slug":"how-to-use-adduser-command-in-linux","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/how-to-use-adduser-command-in-linux\/","title":{"rendered":"How to use the &#8220;adduser&#8221; command in Linux with examples"},"content":{"rendered":"<p>This tutorial by Linuxways.net is aimed at helping users understand the basics of the &#8220;adduser&#8221; command in Linux. It should also provide a guide to help add a new user to an existing Linux machine.<\/p>\n<p>This guide is geared towards novice and intermediate users and contains plenty of images and examples to help them navigate easily. So without further adieu, let&#8217;s get started.<\/p>\n<h2>Adduser command in Linux<\/h2>\n<p>The &#8220;adduser&#8221; command in Linux allows you to create a new user on a Linux system right from the terminal. With the help of the command, you can create a home directory, modify the configurations, add a password and add a default shell as Bash without having to leave the terminal.<\/p>\n<p>The &#8220;adduser&#8221; command is similar to the &#8220;useradd&#8221; command however, the &#8220;adduser&#8221; command is much more interactive and user friendly when compared to the &#8220;useradd&#8221; command.<\/p>\n<h3>Prerequisites of using the Adduser command<\/h3>\n<p>Before you start using the &#8220;adduser&#8221; command, there are some prerequisites that you must meet. You, of course, you need a system that is currently running Linux. You also need access to the root user or a sudo user to install the &#8220;adduser&#8221; command.<\/p>\n<h3>Installing adduser command<\/h3>\n<p>Before using the adduser tool, you must first install it to your Linux distribution. Depending on the specific version, you may need to use specific commands.<\/p>\n<h5><strong>For Debian or Ubuntu<\/strong><\/h5>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\"># <\/span><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">apt-get install<\/span> adduser<\/div><\/div>\n<h5><strong>For CentOS or RedHat<\/strong><\/h5>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\"># <\/span><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">yum install<\/span> adduser<\/div><\/div>\n<h5><strong>For Fedora OS<\/strong><\/h5>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\"># <\/span><span class=\"kw2\">sudo<\/span> dnf <span class=\"kw2\">install<\/span> adduser<\/div><\/div>\n<h5><strong>To test if the command is installed correctly use the code below.\u00a0<\/strong><\/h5>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\"># <\/span>adduser <span class=\"re5\">--version<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19082 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Linuxways-1024x660.png\" alt=\"\" width=\"1020\" height=\"657\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Linuxways-1024x660.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Linuxways-300x193.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Linuxways-768x495.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Linuxways.png 1470w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Once installed, you can start using the &#8220;adduser&#8221; command. A detailed example on how to use it is given below.\u00a0<\/span><\/p>\n<h2><b>Examples of how to use the &#8220;adduser&#8221; command in Linux\u00a0<\/b><\/h2>\n<h5><b>To add a new user<\/b><\/h5>\n<p><span style=\"font-weight: 400;\">To add a new user, simply type the following command.\u00a0<\/span><\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\"># <\/span><span class=\"kw2\">sudo<\/span> adduser name_of_user<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19083 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-2.15.12-am-1024x665.png\" alt=\"\" width=\"1020\" height=\"662\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-2.15.12-am-1024x665.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-2.15.12-am-300x195.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-2.15.12-am-768x499.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-2.15.12-am.png 1450w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<p>Replace name_of_user with the exact name of the new user, and a detailed list of things the &#8220;adduser&#8221; command lets you do will come on the screen.<\/p>\n<p>The command will prompt you to type in your existing Linux password and some other basic questions about the new user. Once you provide the details, a new user will be set up.<\/p>\n<h5><b>To add a system user in a different shell.\u00a0<\/b><\/h5>\n<p><span style=\"font-weight: 400;\">The following command will create a user and will change the default shell to \/bin\/sh.<\/span><\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\"># <\/span><span class=\"kw2\">sudo<\/span> adduser username <span class=\"re5\">--shell<\/span> <span class=\"sy0\">\/<\/span>bin<span class=\"sy0\">\/<\/span><span class=\"kw2\">sh<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19084 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-2.17.35-am-1024x668.png\" alt=\"\" width=\"1020\" height=\"665\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-2.17.35-am-1024x668.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-2.17.35-am-300x196.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-2.17.35-am-768x501.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-2.17.35-am.png 1466w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<h5><b>Add User Password Options<\/b><\/h5>\n<p><span style=\"font-weight: 400;\">If you want to override the password or avoid setting up a password during user creation, use the following command.\u00a0<\/span><\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\"># <\/span><span class=\"kw2\">sudo<\/span> adduser <span class=\"re5\">--disabled-login<\/span> username<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19085 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-2.19.18-am-1024x660.png\" alt=\"\" width=\"1020\" height=\"657\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-2.19.18-am-1024x660.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-2.19.18-am-300x193.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-2.19.18-am-768x495.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-2.19.18-am.png 1474w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<h5><b>Adding a new user with a different configuration file<\/b><\/h5>\n<p><span style=\"font-weight: 400;\">You can configure a new user from the custom_config file using the following command. It will also create a new custom_config filename configuration.<\/span><\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\"># <\/span>adduser username <span class=\"re5\">--conf<\/span> custom_config.conf<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19086 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-2.24.09-am-1024x672.png\" alt=\"\" width=\"1020\" height=\"669\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-2.24.09-am-1024x672.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-2.24.09-am-300x197.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-2.24.09-am-768x504.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-2.24.09-am.png 1470w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<h5><b>Adding a user with a different home directory<\/b><\/h5>\n<p><span style=\"font-weight: 400;\">If you want to add a new user with a different home directory, use the following command.\u00a0<\/span><\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\"># <\/span>adduser username <span class=\"re5\">--home<\/span> <span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>username<span class=\"sy0\">\/<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19087 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-3.09.33-am-1024x671.png\" alt=\"\" width=\"1020\" height=\"668\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-3.09.33-am-1024x671.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-3.09.33-am-300x197.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-3.09.33-am-768x503.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-3.09.33-am.png 1468w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<h5><b>Adding a new group to the system<\/b><\/h5>\n<p><span style=\"font-weight: 400;\">Combining the &#8211;group syntax with the adduser command will allow you to add a new group in the system. Use the following syntax when prompted:<\/span><\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\"># <\/span><span class=\"kw2\">sudo<\/span> adduser <span class=\"re5\">--group<\/span> user_name<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19088 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-3.13.02-am-1024x665.png\" alt=\"\" width=\"1020\" height=\"662\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-3.13.02-am-1024x665.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-3.13.02-am-300x195.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-3.13.02-am-768x499.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-3.13.02-am.png 1466w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><br \/>\n<span style=\"font-weight: 400;\">You can also add &#8211;system option to create a system user and a group with the same name.\u00a0<\/span><\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\"># <\/span><span class=\"kw2\">sudo<\/span> adduser <span class=\"re5\">--group<\/span> <span class=\"re5\">--system<\/span> any_given_name<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19089 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-3.14.19-am-1024x659.png\" alt=\"\" width=\"1020\" height=\"656\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-3.14.19-am-1024x659.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-3.14.19-am-300x193.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-3.14.19-am-768x495.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-3.14.19-am.png 1472w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<h5><strong>To seek assistant if you forget any particular syntax<\/strong><\/h5>\n<p><span style=\"font-weight: 400;\">To remember all the command names can be challenging, even for someone with vast expertise in Linux. So, to display the help section type the command <\/span><\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\"># <\/span>adduser <span class=\"re5\">-h<\/span><\/div><\/div>\n<p>It will show a helpful window of all the adduser commands.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19091 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-3.31.30-am-1024x674.png\" alt=\"\" width=\"1020\" height=\"671\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-3.31.30-am-1024x674.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-3.31.30-am-300x197.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-3.31.30-am-768x505.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-12-06-at-3.31.30-am.png 1462w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p><span style=\"font-weight: 400;\">The adduser command is a simple and user-friendly tool to quickly add a new user to your Linux system. You still get an array of options of setting up password or allowing root access to the new user. However, if you need more granular control, the \u201cuseradd\u201d command may be more handy. Don\u2019t forget to check our other articles for more Linux tips and tricks. <\/span><\/p>","protected":false},"excerpt":{"rendered":"<p>A guide on how use adduser command in Linux with examples<\/p>","protected":false},"author":107,"featured_media":19092,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1051],"class_list":["post-19068","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","tag-adduser"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/19068","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/107"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=19068"}],"version-history":[{"count":3,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/19068\/revisions"}],"predecessor-version":[{"id":19081,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/19068\/revisions\/19081"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/19092"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=19068"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=19068"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=19068"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}