<?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>Internetworking, Security &#38; Tech &#187; Linux</title>
	<atom:link href="http://www.nish.com/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nish.com</link>
	<description></description>
	<lastBuildDate>Sun, 13 May 2012 23:46:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Email Alert on SSH Login</title>
		<link>http://www.nish.com/2012/04/email-alert-on-ssh-login/</link>
		<comments>http://www.nish.com/2012/04/email-alert-on-ssh-login/#comments</comments>
		<pubDate>Sun, 22 Apr 2012 16:31:52 +0000</pubDate>
		<dc:creator>Nish Vamadevan</dc:creator>
				<category><![CDATA[UNIX]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mutt]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.fnode.com/?p=1057</guid>
		<description><![CDATA[The following method can be used when a user login to a linux machine, an email will be sent with IP information. For this to work, you need to have the program mutt installed. Then add the following to the user&#8217;s .bashrc file, which is located in /home/$user/.bashrc echo `who` &#124; /usr/bin/mutt -s "SSH Alert" [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><span class="drop_cap">T</span>he following method can be used when a user login to a linux machine, an email will be sent with <acronym title="Internet Protocol">IP</acronym> information.</p>
<p>For this to work, you need to have the program <strong>mutt</strong> installed.</p>
<p>Then add the following to the user&#8217;s <code>.bashrc</code> file, which is located in <code>/home/$user/.bashrc</code></p>
<pre>echo `who` | /usr/bin/mutt -s "<acronym title="Secure Shell">SSH</acronym> Alert" email@address.here</pre>
<p>For example, if you want an email sent everytime the user <strong>root</strong> login, edit the file <code>/home/root/.bashrc</code> and add the above code.</p>]]></content:encoded>
			<wfw:commentRss>http://www.nish.com/2012/04/email-alert-on-ssh-login/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passwordless SSH Authentication on Linux</title>
		<link>http://www.nish.com/2009/09/passwordless-ssh-authentication-on-linux/</link>
		<comments>http://www.nish.com/2009/09/passwordless-ssh-authentication-on-linux/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 11:54:43 +0000</pubDate>
		<dc:creator>Nish Vamadevan</dc:creator>
				<category><![CDATA[UNIX]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[RSA]]></category>

		<guid isPermaLink="false">http://www.fnode.com/?p=478</guid>
		<description><![CDATA[There are two ways of achieving passwordless authentication on a Linux Box. On Debian/Ubuntu you can just type: $ cd $HOME ~$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key: Press Enter each question and you will have a pair of keys ready to use. You will be asked [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>There are two ways of achieving passwordless authentication on a Linux Box.</p>
<p>On Debian/Ubuntu you can just type:</p>
<pre>
  $ cd $HOME
~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key:
</pre>
<p>Press Enter each question and you will have a pair of keys ready to use.</p>
<p>You will be asked for a passphrase but if you do not want to insert anything just leave it blank. </p>
<p>This procedure will create one private and one public key.</p>
<pre>
$ ls .ssh/
id_rsa  id_rsa.pub  known_hosts
The private key must be secured on your box whereas the public key can be copied across
~$ ssh-copy-id -i .ssh/id_rsa.pub 192.168.1.30
</pre>
<p>At this time you will be asked for the password but once the key has been copied you will be able to ssh just perfectly.</p>
<p><span id="more-478"></span></p>
<p>As additional security you could lock the account to prevent someone without key to ssh into the box. In order to do that </p>
<pre>
me@mybox:~$ ssh 192.168.1.30
me@server:~$ su -
password:
root@server:~# usermod -L me
</pre>
<p><code>usermod -L</code> will lock the account &#8220;me&#8221; preventing anyone using password credentials for that account. You will only be able to access with you trusted ssh-key. If you don&#8217;t want anymore the account locked just type:</p>
<pre>root@server:~# usermod -U me</pre>
<p><code>-U</code> flag will unlock the account</p>
<p>ON SOME OTHER DISTROS:</p>
<p>the &#8220;ssh-copy-id&#8221; utility doesn&#8217;t exist so you will have to copy it manually.<br />
If you can copy and paste then</p>
<pre>
~$ cat .ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAv4k0ChLXCfpF+o/4HcqAqYEivRSHHYsTlXfT4I0jmOAI+MKjVTB/CtKqq4h7KMyXrUUo7vtceac4i2FRSm6PdsWksJXsYxkOj+ZXXD2fOnJIDKfIr41URcZH4qmztYO+/9YYcQudPzNlt9tLx5jrkhI7sLy56OmKRwfrxq+UY7ebt+j7y5DmevJP0u7bzREPUA/rcVoPxH0/u015O2BcaJmNoxR1pNfMC3Oefn1eAkodo6fOa3vHHo7WhSpDL/42xsBWPnOAAEDM9tmOUyCJDc8l4Mzm+TindqY2yL2GPspabaEAV3rfuF9O4Ywe+tVIPc2/YXo9XvQxyXZqHxtcw==== me@mybox
</pre>
<p>Paste the line into the remote server&#8217;s .ssh/authorized_keys file. </p>
<p class="info">
REMEMBER that it&#8217;s just one line so if during copy and paste you get some new line characters that key won&#8217;t work.
</p>
<p>If you can&#8217;t copy and paste and want to have the confidence the key has been correctly copied just scp the id_rsa.pub to the server</p>
<pre>
me@mybox:~$ scp .ssh/id_rsa.pub 192.168.1.30:/home/me/
me@server:~$ ssh 192.168.1.30
me@server:~$ cat id_rsa.pub >> .ssh/authorized_keys
</pre>
<p>For more info</p>
<pre>
man usermod
man ssh-keygen
</pre>]]></content:encoded>
			<wfw:commentRss>http://www.nish.com/2009/09/passwordless-ssh-authentication-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick tip: change default text editor on Linux shell</title>
		<link>http://www.nish.com/2009/09/quick-tip-change-default-text-editor-on-linux-shell/</link>
		<comments>http://www.nish.com/2009/09/quick-tip-change-default-text-editor-on-linux-shell/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 12:52:50 +0000</pubDate>
		<dc:creator>Nish Vamadevan</dc:creator>
				<category><![CDATA[UNIX]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://www.fnode.com/?p=477</guid>
		<description><![CDATA[Doing visudo you get nano instead of your favorite text editor? Mine is vim therefore I issue: DEBIAN/UBUNTU way # update-alternatives --config editor There are 4 alternatives which provide `editor'. Selection Alternative ----------------------------------------------- 1 /usr/bin/vim.tiny 2 /bin/ed *+ 3 /bin/nano 4 /usr/bin/vim.basic Press enter to keep the default[*], or type selection number: Selecting 4 I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Doing visudo you get nano instead of your favorite text editor?<br />
Mine is vim therefore I issue:</p>
<p><strong>DEBIAN/UBUNTU way</strong></p>
<pre>
# update-alternatives --config editor
There are 4 alternatives which provide `editor'.
  Selection    Alternative
-----------------------------------------------
          1    /usr/bin/vim.tiny
          2    /bin/ed
*+        3    /bin/nano
          4    /usr/bin/vim.basic
Press enter to keep the default[*], or type selection number:
</pre>
<p>Selecting 4 I&#8217;m ready to use my full syntax colors when I edit any file.</p>
<p><strong>OTHER DISTROS</strong><br />
Edit your .bashrc file and add the following:</p>
<pre>EDITOR=vim
export EDITOR</pre>
<p>Next login you will have your VIM working.<br />
If you want to have it immediately and only for this session just type </p>
<pre># export EDITOR=vim</pre>
<p>and press enter.</p>]]></content:encoded>
			<wfw:commentRss>http://www.nish.com/2009/09/quick-tip-change-default-text-editor-on-linux-shell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install Debian from USB drive</title>
		<link>http://www.nish.com/2009/08/how-to-install-debian-from-usb-drive/</link>
		<comments>http://www.nish.com/2009/08/how-to-install-debian-from-usb-drive/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 13:13:19 +0000</pubDate>
		<dc:creator>Nish Vamadevan</dc:creator>
				<category><![CDATA[UNIX]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Install]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.fnode.com/?p=472</guid>
		<description><![CDATA[I&#8217;ve come across multiple ways of doing it but so far the best way is the following (I assume you are on i386 platform and you have access to the net): 1. Download boot.img.gz from Debian website 2. Download the net-install image choosing i386. 3. Plug your USB drive into a Linux PC, open the [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I&#8217;ve come across multiple ways of doing it but so far the best way is the following (I assume you are on i386 platform and you have access to the net):<br />
1. Download <a href="ftp://ftp.debian.nl/debian/dists/stable/main/installer-i386/current/images/hd-media/boot.img.gz" rel="nofollow" target="_blank" class="external_icon">boot.img.gz</a> from Debian website<br />
2. Download the <a href="http://www.debian.org/distrib/netinst#smallcd" rel="nofollow" target="_blank" class="external_icon">net-install</a> image choosing i386.<br />
3. Plug your <acronym title="Universal Serial Bus">USB</acronym> drive into a Linux PC, open the shell and type</p>
<pre>
$ dmesg
</pre>
<p>Last few lines should be like the following:</p>
<pre>
 sd 7:0:0:0: [sdb] Attached <acronym title="Small Computer System Interface">SCSI</acronym> removable disk
 sd 8:0:0:0: [sdb] 4030464 512-byte logical blocks: (2.06 <acronym title="Gigabyte">GB</acronym>/1.92 GiB)
 sd 8:0:0:0: [sdb] Write Protect is off
</pre>
<p>Now we know it has been mapped as sdb</p>
<p>4. Use zcat to load the boot.img.gz onto your <acronym title="Universal Serial Bus">USB</acronym> drive</p>
<pre>
# zcat boot.img.gz > /dev/sdb
</pre>
<p>CAUTION!!! this will destroy the entire data on the <acronym title="Universal Serial Bus">USB</acronym> drive, make sure you have done the backup.<br />
If you get an error  ensure the following:<br />
- You are root (don&#8217;t use sudo)<br />
- The <acronym title="Universal Serial Bus">USB</acronym> drive it&#8217;s not mounted, if it is umount it before issuing the above command.</p>
<p>5. Now mount the <acronym title="Universal Serial Bus">USB</acronym> drive and copy the net-inst.iso image on it.</p>
<p>All done! Now plug it into the box you want to setup and enjoy the old fashion Debian installer <img src='http://www.nish.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>]]></content:encoded>
			<wfw:commentRss>http://www.nish.com/2009/08/how-to-install-debian-from-usb-drive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to change the file timestamp on Linux</title>
		<link>http://www.nish.com/2009/08/how-to-change-the-file-timestamp-in-a-linux-system/</link>
		<comments>http://www.nish.com/2009/08/how-to-change-the-file-timestamp-in-a-linux-system/#comments</comments>
		<pubDate>Sat, 29 Aug 2009 19:09:02 +0000</pubDate>
		<dc:creator>Nish Vamadevan</dc:creator>
				<category><![CDATA[UNIX]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://www.fnode.com/?p=464</guid>
		<description><![CDATA[This tip might comes handy when you do a system check and you want to make sure you don&#8217;t check the same file twice. Let&#8217;s pretend that our &#8220;file1&#8243; is a conf file that needs review. As you can see the output of the command issued below shows that the file was last edited in [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>This tip might comes handy when you do a system check and you want to make sure you don&#8217;t check the same file twice.</p>
<p>Let&#8217;s pretend that our &#8220;file1&#8243; is a conf file that needs review. As you can see the output of the command issued below shows that the file was last edited in June.<br />
Today I want to check the file without editing it and make sure next time I won&#8217;t check it again:</p>
<pre>
$ ls -l
total 0
-rw-r--r-- 1 luca luca 290 2009-06-29 16:33 file1
</pre>
<p><a href="http://www.manpagez.com/man/1/touch/" rel="nofollow" target="_blank" class="external_icon">Touch</a> is an excellent tool in this case:</p>
<pre>
$ touch file1
$ ls -l
total 0
-rw-r--r-- 1 luca luca 0 2009-08-29 19:43 file1
</pre>
<p>The Modification Time has changed and so has the access time.</p>
<p>If you want to change just the modification time leaving the access time untouched try with the -m option</p>
<pre>
$ touch -m file1
$ ls -l
total 0
-rw-r--r-- 1 luca luca 0 2009-08-29 19:46 file1
$ stat file1
[..]
Access: 2009-08-29 19:43:45.000000000 +0100
Modify: 2009-08-29 19:46:15.000000000 +0100
Change: 2009-08-29 19:46:15.000000000 +0100
</pre>
<p>And -a is just for the Access Time.</p>
<p>Another interesting option is -t. It lets you set the time and the date with whatever you like. This is often used to do fishy things <img src='http://www.nish.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre>
$ touch -t 200701012301 file1
$ stat file1
[..]
Access: 2007-01-01 23:01:00.000000000 +0000
Modify: 2007-01-01 23:01:00.000000000 +0000
Change: 2009-08-29 19:52:26.000000000 +0100
</pre>]]></content:encoded>
			<wfw:commentRss>http://www.nish.com/2009/08/how-to-change-the-file-timestamp-in-a-linux-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to gain ROOT access to a Linux Box within 10 Seconds</title>
		<link>http://www.nish.com/2007/09/how-to-gain-root-access-to-a-fedora-box-within-10-seconds/</link>
		<comments>http://www.nish.com/2007/09/how-to-gain-root-access-to-a-fedora-box-within-10-seconds/#comments</comments>
		<pubDate>Sat, 08 Sep 2007 22:49:23 +0000</pubDate>
		<dc:creator>Nish Vamadevan</dc:creator>
				<category><![CDATA[UNIX]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[ROOT]]></category>

		<guid isPermaLink="false">http://www.nishv.com/2007/08/14/how-to-gain-root-access-to-a-fedora-box-within-10-seconds/</guid>
		<description><![CDATA[It is pretty easy when it comes to gaining root password to any Linux System as long as you have physical access. This is how to change Fedora&#8217;s ROOT Password. When your box starts up, You will see the GRUB screen… What you need to do is, press the a Key instead of Enter You [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>It is pretty easy when it comes to gaining root password to any Linux System as long as you have physical access.</p>
<p>This is how to change Fedora&#8217;s ROOT Password.</p>
<p>When your box starts up, You will see the GRUB screen…</p>
<p>What you need to do is, press the <strong>a</strong> Key instead of <strong>Enter</strong></p>
<p>You will see something like the following…</p>
<pre>kernel /vmlinuz-2.6.9-1.667 ro root=LABEL=/ acpi=on rhgb quiet</pre>
<p>Add 1 at the end of that… So it looks like the following…</p>
<pre>kernel /vmlinuz-2.6.9-1.667 ro root=LABEL=/ acpi=on rhgb quiet 1</pre>
<p>This will make the box boot into Runlevel 1</p>
<p>You simply type</p>
<pre>passwd</pre>
<p>Enter the new ROOT password and reboot the machine.</p>
<p>Same thing goes for Any Linux System as welll… All you got to do is, add the following kernel argument…</p>
<pre>init=/bin/bash</pre>
<p>And then just change the password…</p>]]></content:encoded>
			<wfw:commentRss>http://www.nish.com/2007/09/how-to-gain-root-access-to-a-fedora-box-within-10-seconds/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

