{"id":1624,"date":"2016-08-08T17:15:34","date_gmt":"2016-08-08T14:15:34","guid":{"rendered":"http:\/\/www.systemcodegeeks.com\/?p=1624"},"modified":"2017-12-04T15:55:45","modified_gmt":"2017-12-04T13:55:45","slug":"linux-create-user-example","status":"publish","type":"post","link":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/","title":{"rendered":"Linux Create User Example"},"content":{"rendered":"<p>This example will show you how to create users in Linux, looking at the two different available commands: the default utility, <code>useradd<\/code>; and a script that acts as more friendly front-end for the default utility, which is named <code>adduser<\/code>.<\/p>\n<p>For this example, Linux Mint 17.03 has been used.<\/p>\n<h2>1. How users are organized<\/h2>\n<p>The existing users of the system are registered in the file <code>\/etc\/passwd<\/code>. <strong>This file defines who has legit access to the system<\/strong>. This is an example of a line of the file:<\/p>\n<pre class=\"brush:bash\">julen:x:1000:1000:Julen Pardo:\/home\/julen:\/bin\/bash<\/pre>\n<p>[ulp id=&#8217;SG9vnnKgRCD7iZxf&#8217;]<br \/>\n&nbsp;<br \/>\nWhich follows the following format:<\/p>\n<pre class=\"brush:bash\">username:password:uid:gid:real_name:home_directory:command_shell<\/pre>\n<ul>\n<li>The <code>username<\/code> is the account name for the login.<\/li>\n<li>The <code>password<\/code> field is actually not used in modern systems. The users credentials are stored in <code>\/etc\/shadow<\/code> file.<\/li>\n<li>The <code>uid<\/code> (user id) and <code>gid<\/code> (group id) are the unique identifiers of the user and the group it belongs to, respectively.<\/li>\n<li>The <code>real_name<\/code> is that, the user&#8217;s real name.<\/li>\n<li>The <code>home_directory<\/code> is the working directory of each user, usually <code>\/home\/&lt;username&gt;<\/code>.<\/li>\n<li>Finally, the <code>command_shell<\/code> is the program that is ran at login. Usually, this is the path to a shell. If not set, <code>\/bin\/sh<\/code> is used.<\/li>\n<\/ul>\n<p><strong>It&#8217;s better not to touch manually this file to add<\/strong> (or modify\/remove) <strong>users<\/strong>. To add users, we should use the methods that we will see in this tutorial.<\/p>\n<h2>2. Using native binary: useradd<\/h2>\n<p><code>useradd<\/code> is the native, low level, binary of Linux systems. Its use is very simple:<\/p>\n<pre class=\"brush:bash\">sudo useradd [options] username # superuser privileges are needed.<\/pre>\n<p>So, we could create a user named <code>john_doe<\/code>:<\/p>\n<pre class=\"brush:bash\">sudo useradd john_doe<\/pre>\n<p>Now, a new user named <code>john_doe<\/code> has been created in the users database. We can check it in the <code>\/etc\/passwd<\/code> file:<\/p>\n<pre class=\"brush:bash\">grep \"john_doe\" \/etc\/passwd<\/pre>\n<p>Which will show:<\/p>\n<pre class=\"brush:bash\">john_doe:x:1002:1005::\/home\/john_doe:<\/pre>\n<h3>2.1. Setting a password<\/h3>\n<p>We have created a user without a password! We can check it in the <code>\/etc\/shadow<\/code> file:<\/p>\n<pre class=\"brush:bash\">grep \"john_doe\" \/etc\/shadow<\/pre>\n<p>Returning:<\/p>\n<pre class=\"brush:bash\">john_doe:!:17018:0:99999:7:::<\/pre>\n<p>That exclamation mark <code>!<\/code> means that no password is set for the user.<\/p>\n<p><strong>Setting a password for each user is not an advice, but mandatory<\/strong>. For this, we have two options: create the user and then set the password (with <code>passwd<\/code> command), or specify it at creation time with <code>-p<\/code> (<code>--password<\/code>) option. The recommended option is the first one, since the second one has two obvious downsides:<\/p>\n<ul>\n<li>The password is visible in the command line.<\/li>\n<li>We are not asked for confirmation, so we won&#8217;t notice if we make a miss typing the password.<\/li>\n<\/ul>\n<p><strong>Use always the <code>passwd<\/code> command to set the passwords<\/strong>. We only have to run it specifying the user, as in the following example:<\/p>\n<pre class=\"brush:bash\">sudo passwd john_doe<\/pre>\n<p>And we will be asked to set the password (with confirmation).<\/p>\n<h3>2.2. Creating the home directory<\/h3>\n<p>Now that we have this new user, we can try to login in the system with it:<\/p>\n<pre class=\"brush:bash\">sudo -u john_doe -i # Login with user john_doe.<\/pre>\n<p>But we will get an error:<\/p>\n<blockquote><p>sudo: unable to change directory to \/home\/john_doe: No such file or directory<\/p><\/blockquote>\n<p>This is because <code>useradd<\/code> <strong>sets the home directory for new users, but it does not create it by default<\/strong>. We can fix it by creating manually the directory, but is better to create the home directory at user creation time. This is achieved passing the <code>-m<\/code> (<code>--create-home<\/code>) option to <code>useradd:<\/code><\/p>\n<pre class=\"brush:bash\">sudo userdel john_doe # To delete it.\r\nsudo useradd john_doe -m<\/pre>\n<p>This will create a directory for the new user. The default behavior for this option is to create the directory with the same name as the created user, in the <code>\/home<\/code> directory.<\/p>\n<h3>2.3. Setting a different home directory<\/h3>\n<p>For some reason, we might want to set the home directory in a different place from <code>\/home<\/code>. This is allowed using the <code>-b<\/code> (<code>--base-dir<\/code>) option. For example:<\/p>\n<pre class=\"brush:bash\">sudo useradd john_doe -b \/tmp<\/pre>\n<p>Will create the following entry in <code>\/etc\/passwd<\/code>:<\/p>\n<pre class=\"brush:bash\">john_doe:x:1002:1005::\/tmp\/john_doe:<\/pre>\n<p>Note that we only have specified <strong>the directory where the home directory will be placed, not the home directory name itself<\/strong>.<\/p>\n<p>When we use this option, we also have to tell <code>userrad<\/code> to create the home directory, as in the example of the previous section:<\/p>\n<pre class=\"brush:bash\">sudo useradd john_doe -b \/tmp -m<\/pre>\n<h3>2.4. Setting the shell<\/h3>\n<p>You may have noticed that the in the line for our user, the value for the shell is not set. Usually, we would want to use <code>\/bin\/bash<\/code> instead of the default <code>\/bin\/sh<\/code>. To specify the shell, we have to use the <code>-s<\/code> (<code>--shell<\/code>) option:<\/p>\n<pre class=\"brush:bash\">sudo useradd john_doe -m -s \/bin\/bash<\/pre>\n<h3>2.5. Other options<\/h3>\n<p>Let&#8217;s see other common options for <code>useradd<\/code> command.<\/p>\n<h4>2.5.1. Specifying the primary group<\/h4>\n<p>The default behavior when creating a user is to create a group for it, with the same name, and set it as primary. But we have the option to avoid this and specify a group name (or <code>gid<\/code>) to be the primary of the creating user. For this, <code>-g<\/code> (<code>--gid<\/code>) option is used, as in the following example:<\/p>\n<pre class=\"brush:bash\">sudo useradd john_doe -g developers<\/pre>\n<p>And <code>john_doe<\/code> will be created with <code>developers<\/code> as primary group. We can check it with the <code>groups<\/code> command:<\/p>\n<pre class=\"brush:bash\">groups john_doe<\/pre>\n<h4>2.5.2. Setting secondary groups<\/h4>\n<p>Similarly to the primary group, we may want to set secondary group(s) for a user at creation time. This time, <code>-G<\/code> (<code>-groups<\/code>) option has to be used, specifying the list of groups separated by commas, without whitespaces, e.g.:<\/p>\n<pre class=\"brush:bash\">sudo useradd john_doe -G developers,another_secondary<\/pre>\n<h4>2.5.3. Setting an expiration date<\/h4>\n<p>This option is useful when we have to create accounts for users that we know beforehand have to have access to the system only until a certain date. For this, we have to use the <code>-e<\/code> (<code>--expiredate<\/code>) option, specifying the date in <code>YYYY-MM-DD<\/code> format. Let&#8217;s see it with an example:<\/p>\n<pre class=\"brush:bash\">sudo useradd john_doe -e 2017-01-01<\/pre>\n<h3>2.5.4. Setting personal information<\/h3>\n<p>Actually, we can set any type of additional comments, but this option is usually used to specify personal information, such as real name. We have to use the <code>-c<\/code> (<code>--comment<\/code>) option, specifying the information between quotes (single or double, doesn&#8217;t matter) if the comment contains whitespaces, e.g.:<\/p>\n<pre class=\"brush:bash\">sudo useradd john_doe -c 'John Doe'<\/pre>\n<p>Will generate the following entry:<\/p>\n<pre class=\"brush:bash\">john_doe:x:1002:1005:John Doe:\/home\/john_doe:<\/pre>\n<h2>3. Using a user-friendly wrapper for useradd: adduser<\/h2>\n<p>With <code>useradd<\/code>, we have seen that creating users is not actually difficult, but, by default, it doesn&#8217;t perform some actions that can be supposed as essential, like creating the home directory. We can even create a user without a password, and do not notice it.<\/p>\n<p>To make user creation easier and in a more comfortable way, <code>adduser<\/code> was created. This is just a Perl script for an interactive use of <code>useradd<\/code>.<\/p>\n<p>If we try to create a user with <code>adduser<\/code>, e.g.:<\/p>\n<pre class=\"brush:bash\">sudo adduser john_doe<\/pre>\n<p>And we will see that, only typing that, <code>adduser<\/code> does many things for us:<\/p>\n<blockquote><p>Adding user `john_doe&#8217; &#8230;<br \/>\nAdding new group `john_doe&#8217; (1001) &#8230;<br \/>\nAdding new user `john_doe&#8217; (1002) with group `john_doe&#8217; &#8230;<br \/>\n<strong>Creating home directory `\/home\/john_doe&#8217; &#8230;<\/strong><br \/>\nCopying files from `\/etc\/skel&#8217; &#8230;<br \/>\nEnter new UNIX password:<br \/>\nRetype new UNIX password:<br \/>\n<strong>passwd: password updated successfully<\/strong><br \/>\nChanging the user information for john_doe<br \/>\nEnter the new value, or press ENTER for the default<br \/>\nFull Name []: <em>John Doe<\/em><br \/>\nRoom Number []: <em>1<\/em><br \/>\nWork Phone []: <em>111-111-111<\/em><br \/>\nHome Phone []: <em>222-222-222<\/em><br \/>\nOther []: <em>333-333-333<\/em><br \/>\nIs the information correct? [Y\/n] <em>Y<\/em><\/p><\/blockquote>\n<p>(In italic the values specified by hand).<\/p>\n<p>That is, apart from creating the home directory and setting the password with <code>passwd<\/code>, also allows to set personal information about the user. And also sets <code>\/bin\/bash<\/code> for the shell. This is the line that has been added in <code>\/etc\/passwd<\/code> for the user we have just created:<\/p>\n<pre class=\"brush:bash\">john_doe:x:1002:1001:John Doe,1,111-111-111,222-222-222,333-333-333:\/home\/john_doe:\/bin\/bash<\/pre>\n<h3>3.1. Changing the options<\/h3>\n<p>Even if <code>adduser<\/code> does makes more comfortable the user creation, we can change the options. Let&#8217;s see the equivalents for <code>adduser<\/code> that we have seen for <code>useradd<\/code>.<\/p>\n<p>The format is the same as with <code>useradd<\/code>:<\/p>\n<pre class=\"brush:bash\">sudo adduser &lt;username&gt; [option1] &lt;value1&gt;...[optionN] &lt;valueN&gt;<\/pre>\n<ul>\n<li>Changing the home directory: <code>--home<\/code><\/li>\n<li>Changing the shell: <code>--shell<\/code><\/li>\n<li>Specifying the primary group: <code>--ingroup<\/code><code><\/code><\/li>\n<\/ul>\n<p>The <code>adduser<\/code> utility does not provide options for setting secondary groups and and an expiration date.<\/p>\n<h2>4. Summary<\/h2>\n<p>This example has shown how to create users in Linux systems, with two different commands: <code>useradd<\/code> and <code>adduser<\/code>. As we have seen, <code>adduser<\/code> can be considered a <em>better<\/em> (in terms of usability) option, since it performs two essential actions that <code>useradd<\/code> does not perform by default: create a home directory, and set a password. Even if a user creation can require more options, those two are always fundamental.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This example will show you how to create users in Linux, looking at the two different available commands: the default utility, useradd; and a script that acts as more friendly front-end for the default utility, which is named adduser. For this example, Linux Mint 17.03 has been used. 1. How users are organized The existing &hellip;<\/p>\n","protected":false},"author":25,"featured_media":185,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[76],"class_list":["post-1624","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bash","tag-users"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux Create User Example - System Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"This example will show you how to create users in Linux, looking at the two different available commands: the default utility, useradd; and a script that\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux Create User Example - System Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"This example will show you how to create users in Linux, looking at the two different available commands: the default utility, useradd; and a script that\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/\" \/>\n<meta property=\"og:site_name\" content=\"System Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/systemcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2016-08-08T14:15:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-12-04T13:55:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/bash-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Toni\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@systemcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@systemcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Toni\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/\"},\"author\":{\"name\":\"Toni\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/69a7de154310f99cedabb63c580291b2\"},\"headline\":\"Linux Create User Example\",\"datePublished\":\"2016-08-08T14:15:34+00:00\",\"dateModified\":\"2017-12-04T13:55:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/\"},\"wordCount\":1228,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/bash-logo.jpg\",\"keywords\":[\"users\"],\"articleSection\":[\"BASH\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/\",\"url\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/\",\"name\":\"Linux Create User Example - System Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/bash-logo.jpg\",\"datePublished\":\"2016-08-08T14:15:34+00:00\",\"dateModified\":\"2017-12-04T13:55:45+00:00\",\"description\":\"This example will show you how to create users in Linux, looking at the two different available commands: the default utility, useradd; and a script that\",\"breadcrumb\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/#primaryimage\",\"url\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/bash-logo.jpg\",\"contentUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/bash-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.systemcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Shell Scripting\",\"item\":\"https:\/\/www.systemcodegeeks.com\/category\/shell-scripting\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"BASH\",\"item\":\"https:\/\/www.systemcodegeeks.com\/category\/shell-scripting\/bash\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Linux Create User Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#website\",\"url\":\"https:\/\/www.systemcodegeeks.com\/\",\"name\":\"System Code Geeks\",\"description\":\"Operating System Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.systemcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.systemcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/systemcodegeeks\",\"https:\/\/x.com\/systemcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/69a7de154310f99cedabb63c580291b2\",\"name\":\"Toni\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/21c1661474c78b4757355b8beef9ab1d14f490ee3a3e67392f4e618d36643d4c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/21c1661474c78b4757355b8beef9ab1d14f490ee3a3e67392f4e618d36643d4c?s=96&d=mm&r=g\",\"caption\":\"Toni\"},\"url\":\"https:\/\/www.systemcodegeeks.com\/author\/julen-pardo\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux Create User Example - System Code Geeks - 2026","description":"This example will show you how to create users in Linux, looking at the two different available commands: the default utility, useradd; and a script that","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/","og_locale":"en_US","og_type":"article","og_title":"Linux Create User Example - System Code Geeks - 2026","og_description":"This example will show you how to create users in Linux, looking at the two different available commands: the default utility, useradd; and a script that","og_url":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/","og_site_name":"System Code Geeks","article_publisher":"https:\/\/www.facebook.com\/systemcodegeeks","article_published_time":"2016-08-08T14:15:34+00:00","article_modified_time":"2017-12-04T13:55:45+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/bash-logo.jpg","type":"image\/jpeg"}],"author":"Toni","twitter_card":"summary_large_image","twitter_creator":"@systemcodegeeks","twitter_site":"@systemcodegeeks","twitter_misc":{"Written by":"Toni","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/#article","isPartOf":{"@id":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/"},"author":{"name":"Toni","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/69a7de154310f99cedabb63c580291b2"},"headline":"Linux Create User Example","datePublished":"2016-08-08T14:15:34+00:00","dateModified":"2017-12-04T13:55:45+00:00","mainEntityOfPage":{"@id":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/"},"wordCount":1228,"commentCount":0,"publisher":{"@id":"https:\/\/www.systemcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/bash-logo.jpg","keywords":["users"],"articleSection":["BASH"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/","url":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/","name":"Linux Create User Example - System Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.systemcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/#primaryimage"},"image":{"@id":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/bash-logo.jpg","datePublished":"2016-08-08T14:15:34+00:00","dateModified":"2017-12-04T13:55:45+00:00","description":"This example will show you how to create users in Linux, looking at the two different available commands: the default utility, useradd; and a script that","breadcrumb":{"@id":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/#primaryimage","url":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/bash-logo.jpg","contentUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/bash-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.systemcodegeeks.com\/shell-scripting\/bash\/linux-create-user-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.systemcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Shell Scripting","item":"https:\/\/www.systemcodegeeks.com\/category\/shell-scripting\/"},{"@type":"ListItem","position":3,"name":"BASH","item":"https:\/\/www.systemcodegeeks.com\/category\/shell-scripting\/bash\/"},{"@type":"ListItem","position":4,"name":"Linux Create User Example"}]},{"@type":"WebSite","@id":"https:\/\/www.systemcodegeeks.com\/#website","url":"https:\/\/www.systemcodegeeks.com\/","name":"System Code Geeks","description":"Operating System Developers Resource Center","publisher":{"@id":"https:\/\/www.systemcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.systemcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.systemcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.systemcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/systemcodegeeks","https:\/\/x.com\/systemcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/69a7de154310f99cedabb63c580291b2","name":"Toni","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/21c1661474c78b4757355b8beef9ab1d14f490ee3a3e67392f4e618d36643d4c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/21c1661474c78b4757355b8beef9ab1d14f490ee3a3e67392f4e618d36643d4c?s=96&d=mm&r=g","caption":"Toni"},"url":"https:\/\/www.systemcodegeeks.com\/author\/julen-pardo\/"}]}},"_links":{"self":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/posts\/1624","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/users\/25"}],"replies":[{"embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/comments?post=1624"}],"version-history":[{"count":0,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/posts\/1624\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/media\/185"}],"wp:attachment":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/media?parent=1624"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/categories?post=1624"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/tags?post=1624"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}