{"id":11343,"date":"2019-03-13T04:16:29","date_gmt":"2019-03-13T04:16:29","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=11343"},"modified":"2019-03-13T04:16:29","modified_gmt":"2019-03-13T04:16:29","slug":"how-to-create-multiple-user-accounts-in-linux","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/13\/how-to-create-multiple-user-accounts-in-linux\/","title":{"rendered":"How to Create Multiple User Accounts in Linux"},"content":{"rendered":"<p>The two utilities for adding or creating user accounts in Unix\/Linux systems are\u00a0<strong>adduser<\/strong>\u00a0and\u00a0<a href=\"https:\/\/www.tecmint.com\/add-users-in-linux\/\" target=\"_blank\" rel=\"noopener\">useradd<\/a>. These commands are designed to add a single user account in the system at a time. What if you have multiple users accounts to be created? That\u2019s when you need a program such as\u00a0<strong>newusers<\/strong>.<\/p>\n<p><strong>Newusers<\/strong>\u00a0is a useful command line utility used to update and create new user accounts at a single time. It is intended to be used in IT environments with large systems where a system administrator needed to update or create multiple user accounts in batch. It reads information from\u00a0<strong>stdin<\/strong>\u00a0(by default) or a file to update a set of existing user accounts or to create new users.<\/p>\n<p>In this article, we will explain how to create multiple user accounts in batch mode using\u00a0<strong>Newusers<\/strong>\u00a0utility in Linux systems.<\/p>\n<p>To create users in a batch, you can provide their information in a file in the following format, same as the standard password file:<\/p>\n<pre>pw_name:pw_passwd:pw_uid:pw_gid:pw_gecos:pw_dir:pw_shell<\/pre>\n<pre>\/bash\r\n<\/pre>\n<div id=\"attachment_31104\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Create-Multiple-User-Accounts-in-Linux.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31104\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Create-Multiple-User-Accounts-in-Linux.png\" alt=\"Create Multiple User Accounts in Linux\" width=\"672\" height=\"78\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Create Multiple User Accounts in Linux<\/p>\n<\/div>\n<p>Save the file and set the required permissions on it.<\/p>\n<pre>$ sudo chmod 0600 users.txt \r\n<\/pre>\n<p>Now run the\u00a0<strong>newusers<\/strong>\u00a0command with the input file to add the above user accounts at once.<\/p>\n<pre>$ sudo newusers users.txt\r\n<\/pre>\n<p>First,\u00a0<strong>newusers<\/strong>\u00a0program tries to create or update the specified accounts, and then write these changes to the user or group databases. In case of any errors except in the final writes to the databases, no changes are committed to the databases. This is simply how the newusers command works.<\/p>\n<p>If the previous command is successful, check the\u00a0<strong>\/etc\/passwd<\/strong>\u00a0and\u00a0<strong>\/etc\/groups<\/strong>\u00a0files to confirm that the user accounts have been added as shown.<\/p>\n<pre>$ cat \/etc\/passwd | grep -E \"ravi|tecmint\"\r\n<\/pre>\n<div id=\"attachment_31103\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Verify-User-Accounts-in-Linux.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31103\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Verify-User-Accounts-in-Linux.png\" alt=\"Verify User Accounts in Linux\" width=\"672\" height=\"78\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Verify User Accounts in Linux<\/p>\n<\/div>\n<p>For more information, see the\u00a0<strong>newuser<\/strong>\u00a0man page.<\/p>\n<pre>$ man newuser \r\n<\/pre>\n<p>You might also like to check these following related articles.<\/p>\n<ol>\n<li><a href=\"https:\/\/www.tecmint.com\/change-a-users-default-shell-in-linux\/\" target=\"_blank\" rel=\"noopener\">3 Ways to Change a Users Default Shell in Linux<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/create-a-shared-directory-in-linux\/\" target=\"_blank\" rel=\"noopener\">How to Create a Shared Directory for All Users in Linux<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/whowatch-monitor-linux-users-and-processes-in-real-time\/\" target=\"_blank\" rel=\"noopener\">Whowatch \u2013 Monitor Linux Users and Processes in Real Time<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/send-a-message-to-logged-users-in-linux-terminal\/\" target=\"_blank\" rel=\"noopener\">How to Send a Message to Logged Users in Linux<\/a><\/li>\n<\/ol>\n<p>In this article, we\u2019ve explained how to create multiple users in Linux using\u00a0<strong>newusers<\/strong>\u00a0program. Use the feedback form below to ask any questions or share your comments with us. If you know of any similar utilities out there, let us know as well.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/create-multiple-user-accounts-in-linux\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The two utilities for adding or creating user accounts in Unix\/Linux systems are\u00a0adduser\u00a0and\u00a0useradd. These commands are designed to add a single user account in the system at a time. What if you have multiple users accounts to be created? That\u2019s when you need a program such as\u00a0newusers. Newusers\u00a0is a useful command line utility used to &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/13\/how-to-create-multiple-user-accounts-in-linux\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Create Multiple User Accounts in Linux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-11343","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11343","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=11343"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11343\/revisions"}],"predecessor-version":[{"id":11348,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11343\/revisions\/11348"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=11343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=11343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=11343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}