<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>FettesPS &#187; man useradd</title>
	<atom:link href="http://www.fettesps.com/tag/man-useradd/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fettesps.com</link>
	<description>Fettes Programming Solutions</description>
	<lastBuildDate>Sun, 22 Jan 2012 18:21:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Creating a New User</title>
		<link>http://www.fettesps.com/unix-creating-a-new-user/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=unix-creating-a-new-user</link>
		<comments>http://www.fettesps.com/unix-creating-a-new-user/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 02:50:18 +0000</pubDate>
		<dc:creator>FettesPS</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[adduser]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[man adduser]]></category>
		<category><![CDATA[man useradd]]></category>
		<category><![CDATA[mandrake]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[sh]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[useradd]]></category>

		<guid isPermaLink="false">http://www.fettesps.com/?p=339</guid>
		<description><![CDATA[Creating a user in Linux is a simple task. Well, kinda. You can quickly create a user without specifying much of it&#8217;s characteristics, or you can get much more in depth with security, default shells and other customizations. I recommend taking the time to learn beyond the basics or you may find yourself making a [...]]]></description>
			<content:encoded><![CDATA[<p>Creating a user in Linux is a simple task. Well, kinda.  You can quickly create a user without specifying much of it&#8217;s characteristics, or you can get much more in depth with security, default shells and other customizations.  I recommend taking the time to learn beyond the basics or you may find yourself making a simple mistake. For the longest time I created my user&#8217;s with a command like this:</p>
<pre class="brush: bash; title: ; notranslate">sudo useradd -d /home/username -m username
sudo passwd username</pre>
<p>I had thought for a long time this was sufficient.  It created their home directory with the <em>-m</em> parameter and specified that location with the <em>-d</em> parameter.  After that I set the password and the user was now able to login to the system with basic privileges. But after a while I began to notice some quirks with those users.  They didn&#8217;t act like the initial admin user that was created by the installation process.  I found that the prompt was a bit less informative.  It also lacked a history, and the ability to hit tab to complete a directory as you typed it.  I even found myself copying over the root .bashrc and trying to figure out what ws different between the users.  Then I typed in the following command just to make sure it was using bash:</p>
<pre class="brush: bash; title: ; notranslate">echo $SHELL</pre>
<p>I looked at the response.</p>
<pre class="brush: bash; title: ; notranslate">/bin/sh</pre>
<p>*face-palm*</p>
<p>No wonder .bashrc didn&#8217;t do anything, I was using a completely different shell for my subsequent users.  I had never taken the time to learn the difference between the various shells, most systems use bash by default so that is what I learned and got used to.  So I never even realized they were using sh instead of bash. </p>
<p>To quickly change the shell for an established user to bash just run the command:</p>
<pre class="brush: bash; title: ; notranslate">chsh -s /bin/bash username</pre>
<p>Since then I&#8217;ve adjusted my create user command to include bash as my default shell.</p>
<pre class="brush: bash; title: ; notranslate">sudo useradd -d /home/username -m username -s /bin/bash</pre>
<p>There are many more parameters that you can add on to this command. If you&#8217;d like to read up on those then just type <em>man useradd</em> and read through the documentation.  Or if you want a very verbose and easy to use command to create your users you can always try <em>adduser</em>.  Instead of passing in which parameters you want to specify it will prompt you on every possibility.  Great for if you don&#8217;t know which options exist, but also somewhat overwhelming in the beginning.</p>
<pre class="brush: bash; title: ; notranslate">mradmin@microsoft$ sudo adduser username
Password: ******
Adding user `username’…
Adding new group `username’ (1337).
Adding new user `username’ (1337) with group `username’.
Creating home directory `/home/username’.
Copying files from `/etc/skel’
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for username
Enter the new value, or press ENTER for the default
Full Name []: Example User
Room Number []: 0
Work Phone []: 604-6122
Home Phone []: 604-6222
Other []:
Is the information correct? [y/N] </pre>
<p>The choice of which two methods to use is a mater of preference.  In the long run, what matters is that you educate yourself on what all of the available options do.  And remember, <em>man useradd</em> and <em>man adduser</em> are your friends!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fettesps.com/unix-creating-a-new-user/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

