<?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>blog.tordeu.com &#187; debian</title>
	<atom:link href="http://blog.tordeu.com/?feed=rss2&#038;tag=debian-2" rel="self" type="application/rss+xml" />
	<link>http://blog.tordeu.com</link>
	<description>a blog about stuff</description>
	<lastBuildDate>Thu, 25 Apr 2013 07:03:01 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.2</generator>
		<item>
		<title>Changing PATH to include /sbin or: How to fix &#8220;bash: ldconfig: command not found&#8221;</title>
		<link>http://blog.tordeu.com/?p=374</link>
		<comments>http://blog.tordeu.com/?p=374#comments</comments>
		<pubDate>Fri, 08 Jun 2012 00:23:51 +0000</pubDate>
		<dc:creator>tordeu</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Command Line]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[PATH]]></category>
		<category><![CDATA[profile]]></category>
		<category><![CDATA[sbin]]></category>

		<guid isPermaLink="false">http://blog.tordeu.com/?p=374</guid>
		<description><![CDATA[It&#8217;s been a while, but in the oh so distant past I stumbled upon the following error on my then fairly new Debian Wheezy system: bash: ldconfig: command not found You might encounter this error or something very similar, especially when you are using sudo instead of changing to root with su (see my article <a href='http://blog.tordeu.com/?p=374'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>It&#8217;s been a while, but in the oh so distant past I stumbled upon the following error on my then fairly new Debian Wheezy system:</p>
<pre>bash: ldconfig: command not found</pre>
<p>You might encounter this error or something very similar, especially when you are using sudo instead of changing to root with su (<a title="How to enable sudo in Linux (here: Debian Squeeze)?" href="http://blog.tordeu.com/?p=31">see my article on how to enable sudo</a>).</p>
<p>&nbsp;</p>
<h2>Problem</h2>
<p>The problem is that programs like ldconfig are located in the  /sbin folder, but this folder is not added to the PATH variable.</p>
<p>If you don&#8217;t know what PATH is:</p>
<p>The path variable is essentially a list of folders. When you type a command in bash (the terminal/command line) like this:</p>
<pre>ldconfig</pre>
<p>then bash will go through all the folders listed in the PATH variable and see if a program with that name is in that folder. If it finds that program, it will execute it.</p>
<p>The problem here is that PATH (the list of directories where bash will look for the program) does not contain the folder /sbin. But because the program is in this folder and bash does not look there, bash will not find the program and instead annoy you with an error.</p>
<p>&nbsp;</p>
<h2>Solution</h2>
<p>The solution is to add  &#8220;/sbin&#8221; to the PATH variable. This can be done by editing the file &#8220;/etc/profile&#8221;.</p>
<p>Type</p>
<pre>sudo nano /etc/profile</pre>
<p>or &#8211; if you are more comfortable with a GUI based text editor &#8211; you can also type</p>
<pre>sudo gedit /etc/profile</pre>
<p>&nbsp;</p>
<p>At the beginning of the file, you will see the following:</p>
<pre>if [ "`id -u`" -eq 0 ]; then
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
  PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi</pre>
<p>This sets the PATH variable for the root user and every other user. The first line that starts with &#8220;PATH=&#8230;&#8221; sets the PATH for the root user and the second line sets PATH for everybody else. So the code fragment basically translates to:</p>
<pre>if user=root then
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
otherwise
  PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"</pre>
<p>The second line is what we have to care right now. The directories in the list are separated by a colon, so the list contains the following directories:</p>
<ul>
<li>
<pre>/usr/local/bin</pre>
</li>
<li>
<pre>/usr/bin</pre>
</li>
<li>
<pre>/bin</pre>
</li>
<li>
<pre>/usr/local/games</pre>
</li>
<li>
<pre>/usr/games</pre>
</li>
</ul>
<p>We want to add a few directories to that, namely:</p>
<ul>
<li>
<pre>/usr/local/sbin</pre>
</li>
<li>
<pre>/usr/sbin</pre>
</li>
<li>
<pre>/sbin</pre>
</li>
</ul>
<p>For ldconfig and a lot of other programs, adding &#8220;/sbin&#8221; would be enough, but I added the others as well, because I thought: &#8220;I don&#8217;t wanna come back two more times, just because I might realize later that I should have added them as well in the first place&#8221;</p>
<p>You could add the directories anywhere in the list, but I like to add them in the same order they appear in the PATH variable for the root user, so I will change the beginning of the file to this (remember to separate the directories with a colon):</p>
<pre>if user=root then
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
otherwise
  PATH="<span style="color: #ff0000;">/usr/local/sbin:</span>/usr/local/bin:<span style="color: #ff0000;">/usr/sbin:</span>/usr/bin:<span style="color: #ff0000;">/sbin:</span>/bin:/usr/local/games:/usr/games"
fi</pre>
<p>Save the file; when using nano, just</p>
<ul>
<li>hit &#8220;Ctrl+X&#8221; to quit</li>
<li>then &#8220;Y&#8221; to confirm that you want to save the modified version</li>
<li>then hit the enter key to confirm the filename</li>
</ul>
<p>And finally: Log out and log back in.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tordeu.com/?feed=rss2&#038;p=374</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>How to enable sudo in Linux (here: Debian Squeeze)?</title>
		<link>http://blog.tordeu.com/?p=31</link>
		<comments>http://blog.tordeu.com/?p=31#comments</comments>
		<pubDate>Fri, 24 Jun 2011 09:03:38 +0000</pubDate>
		<dc:creator>tordeu</dc:creator>
				<category><![CDATA[Command Line]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sudo]]></category>
		<category><![CDATA[sudoers]]></category>

		<guid isPermaLink="false">http://blog.tordeu.com/?p=31</guid>
		<description><![CDATA[Introduction In Linux, it is recommended to work in a terminal as a normal user and use sudo to run commands as a superuser in case you need root privileges for a specific task, instead of creating a root session with su and eventually shoot yourself in the foot (if you&#8217;re lucky), which is far <a href='http://blog.tordeu.com/?p=31'>[...]</a>]]></description>
				<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In Linux, it is recommended to work in a terminal as a normal user and use sudo to run commands as a superuser in case you need root privileges for a specific task, instead of creating a root session with su and eventually shoot yourself in the foot (if you&#8217;re lucky), which is far more likely this way.</p>
<h2>Problem</h2>
<p>In a fresh Debian (Squeeze) installation however, sudo will not work. If you try to run sudo, you will get the following error message:</p>
<p><span id="more-31"></span></p>
<pre>&lt;username&gt; is not in the sudoers file</pre>
<p>(Of course, instead of &#8220;&lt;username&gt;&#8221; it will list your username)</p>
<h2>Explanation</h2>
<p>Sudo will not work, because the user that is created during the installation is not added to the group &#8220;sudo&#8221;. However, you need to be a member of that group to be able to use sudo (Note: Depending on your distribution, the group might have a different name, like &#8220;sudoers&#8221;, &#8220;admin&#8221; (like in Ubuntu) or maybe something else. In that case you have to look up the name of the group).</p>
<p>You can check if you are a member of that group by getting a list of all groups you a member of by typing in the terminal:</p>
<pre>groups</pre>
<p>The group &#8220;sudo&#8221; will most like not be listed.</p>
<h2>The Solution</h2>
<p>To be able to use sudo, you need to be a member of a group named &#8220;sudo&#8221; (as noted above, this name might be different in other linux distributions). To become a member of this group, open a terminal and first get root access by typing:</p>
<pre>su</pre>
<p>Enter the root password when asked and then type the following:</p>
<pre>adduser &lt;username&gt; sudo</pre>
<p>Replace &lt;username&gt; with your username or the username of the user you want to give the possibility to use sudo (and depending on which linux distribution you use, you might need to replace &#8220;sudo&#8221; with the appropriate name of the group)</p>
<p>Now, that you are a member of this group, you are <span style="text-decoration: underline;">almost</span> done.</p>
<p>Exit your root session by typing:</p>
<pre>exit</pre>
<p>If you now type in</p>
<pre>groups</pre>
<p>you will probably notice that &#8220;sudo&#8221; is still <span style="text-decoration: underline;">not</span> listed and if you try running sudo you will still get an error message complaining that &#8220;&lt;username&gt; is not in the sudoers file&#8221;. Don&#8217;t panic! Just log out and back in to finish the process and if you open a terminal then, everything should be fine.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tordeu.com/?feed=rss2&#038;p=31</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
