<?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>Technical Diary &#187; *nix</title>
	<atom:link href="http://andriigrytsenko.net/category/nix/feed/" rel="self" type="application/rss+xml" />
	<link>http://andriigrytsenko.net</link>
	<description>With Andrii Grytsenko</description>
	<lastBuildDate>Wed, 28 Jul 2010 09:02:46 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Clean up the shared memory in Solaris</title>
		<link>http://andriigrytsenko.net/2010/03/clean-up-the-shared-memory-in-solaris/</link>
		<comments>http://andriigrytsenko.net/2010/03/clean-up-the-shared-memory-in-solaris/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 15:44:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[*nix]]></category>
		<category><![CDATA[solaris]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=713</guid>
		<description><![CDATA[Here is short trick how to clean the shared memory up in Solaris OS. 

Here is short info about the host(solaris 5.9, arch sparc):
uname -a
SunOS hostname1 5.9 Generic_118558-25 sun4u sparc SUNW,Sun-Fire-V890 Solaris

To see all shared memory segment, use ipcs

user1@~>ipcs -m -a
IPC status from  as of Wed Mar 10 16:26:20 CET 2010
T    [...]]]></description>
			<content:encoded><![CDATA[<p>Here is short trick how to clean the shared memory up in Solaris OS. </p>
<p><span id="more-713"></span></p>
<p>Here is short info about the host(solaris 5.9, arch sparc):</p>
<pre>uname -a
SunOS hostname1 5.9 Generic_118558-25 sun4u sparc SUNW,Sun-Fire-V890 Solaris
</pre>
<p>To see all shared memory segment, use <em>ipcs</em></p>
<pre>
user1@~>ipcs -m -a
IPC status from <running system> as of Wed Mar 10 16:26:20 CET 2010
T         ID      KEY        MODE        OWNER    GROUP  CREATOR   CGROUP NATTCH      SEGSZ  CPID  LPID   ATIME    DTIME    CTIME
Shared Memory:
m       4608   0x5efaa728 --rw-r-----   oracle oinstall   oracle oinstall     23 3992993792  5720 18925 16:24:47 16:24:47 11:59:42
m    5246977   0x517b6233 --rw-r--r-- user1   os_int user1   os_int     32    7352048 10685 16417 16:21:26 16:21:26 16:13:35
m    1969154   0x22b80b3e --rw-r--r-- user1   os_int user1   os_int      3   72552448 10689 11443 16:14:19 16:13:51 16:13:37
m    1967619   0x1b68b6e6 --rw-r--r-- user1   os_int user1   os_int      8  438326272 10689 16417 16:21:26 16:21:26 16:13:38
m    1966084   0x5724f977 --rw-r--r-- user1   os_int user1   os_int     14  212926464 10689 11379 16:14:27 16:13:50 16:13:40
m    1966085   0x534aab2a --rw-r--r-- user1   os_int user1   os_int     10  216572928 10689 11442 16:14:38 16:13:51 16:13:42
m   11391045   0x7bfc552e --rw-r--r-- user2   os_int user2   os_int      0    7352048  8047  9445 14:43:22 14:43:40 13:41:22
m   10461766   0x63fcba9b --rw-r--r-- user2   os_int user2   os_int      0   72552448  8114  9457 14:43:22 14:43:38 13:41:25
m    9721415   0x5cad6643 --rw-r--r-- user2   os_int user2   os_int      0  583097344  8114  9459 14:43:22 14:43:38 13:41:27
m    9655368   0x1869a8d4 --rw-r--r-- user2   os_int user2   os_int      0  212926464  8114  9466 14:43:22 14:43:38 13:41:29
m    9753673   0x148f5a87 --rw-r--r-- user2   os_int user2   os_int      0  216572928  8114  9473 14:43:22 14:43:38 13:41:31
</pre>
<p>To delete/destroy/remove any segment of the shared memory, use <em>ipcrm</em>. You can specify segment by  <em>shmkey</em>(3-rd field in ipcs output) or by <em>shmid</em>(2-nd field) use <strong>-M</strong> and <strong>-m</strong> accordingly . Like : </p>
<pre>ipcrm -m 4608</pre>
<p>or </p>
<pre>ipcrm -M 0x5efaa728</pre>
<p>To remove all segment in shared memory where owner is <em>user1</em>, run </p>
<pre>ipcs -m -a | awk '{if($5 ~ /user1/ &#038;&#038; $1 ~ /m/) print "ipcrm -m "$2;}' | bash</pre>
<p>END.</p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2010/03/clean-up-the-shared-memory-in-solaris/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Testing IMAP and POP3 servers over the telnet</title>
		<link>http://andriigrytsenko.net/2009/09/testing-imap-and-pop3-servers-over-the-telnet/</link>
		<comments>http://andriigrytsenko.net/2009/09/testing-imap-and-pop3-servers-over-the-telnet/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 12:49:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[*nix]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[imap]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[pop3]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=456</guid>
		<description><![CDATA[Command list of IMAP and POP3 protocols. They can be used to test your server remotely over telnet connection.

Assume you set up pop3 and imap and want to check it out. 
POP3 
POP3 is quite simple protocol. I think you will make out how it&#8217;s work without any problem. 
First, let&#8217;s go to check the [...]]]></description>
			<content:encoded><![CDATA[<p>Command list of IMAP and POP3 protocols. They can be used to test your server remotely over telnet connection.<br />
<span id="more-456"></span></p>
<p>Assume you set up pop3 and imap and want to check it out. </p>
<p><center><strong>POP3 </strong></center><br />
POP3 is quite simple protocol. I think you will make out how it&#8217;s work without any problem. </p>
<p>First, let&#8217;s go to check the POP3 server. Make sure that it bound at port 110: </p>
<pre># netstat -lnp | grep 110
tcp        0      0 0.0.0.0:110                 0.0.0.0:*                   LISTEN      2779/dovecot</pre>
<p>As you can see I use dovecot as server application and it&#8217;s works on all interfaces.<br />
Next, make connection attempt:</p>
<pre># telnet 127.0.0.1 110
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
+OK Dovecot ready.</pre>
<p>Now, we got server answer. Do authorization with command <em>user</em> and <em>pass</em></p>
<pre>USER user1
+OK
PASS qwe
+OK Logged in.</pre>
<p>and <em>LIST</em> to see headers of all inbox mails:</p>
<pre>LIST
+OK 1 messages:
1 306
.</pre>
<p>We have only one mail. First field of answer means
<pre>mail_id</pre>
<p>.<br />
To see whole mail use <em>RETR mail_id</em>: </p>
<pre>RETR 1
+OK 306 octets
Return-Path: <fd@test.com>
Received: from d (node1 [10.0.30.1])
        by mail.test.com (8.13.8/8.13.8) with SMTP id n8ONtVLG011279
        for user1@test.com; Fri, 25 Sep 2009 03:04:08 +0300
Date: Fri, 25 Sep 2009 03:04:08 +0300
From: fd@test.com
Message-Id: <200909250004.n8ONtVLG011279@mail.test.com>
test</pre>
<p>To delete it:</p>
<pre>DELE 1
+OK Marked to be deleted.</pre>
<p>This message marked as deleted and will be removed when you send command <em>QUIT</em> to server. To unmark messages use command <em>RSET</em> without any arguments:</p>
<pre>RSET
+OK</pre>
<p>Use command <em>QUIT</em> to leave the server.</p>
<pre>QUIT
+OK Logging out.</pre>
<p>Refer to <a href="http://www.faqs.org/rfcs/rfc1939.html">RFC 1939</a> for more details.</p>
<p><center><strong>IMAP</strong></center><br />
By default IMAP listen port 143. Therefore let&#8217;s check it first:
<pre>
# netstat -lnp | grep 143
tcp        0      0 0.0.0.0:143                 0.0.0.0:*                   LISTEN      2779/dovecot</pre>
<p>Try to connect: </p>
<pre># telnet localhost 143
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
* OK Dovecot ready.</pre>
<p>Okay, we have got good answer. Now, we should authorize on server. Syntax is:<br />
<em>? LOGIN USER/ALIAS PASSWORD</em></p>
<p>For example:</p>
<pre>? login user1 qwe
? OK Logged in.</pre>
<p>To get folders list make: </p>
<pre>? LIST "" "*"
* LIST (\NoInferiors \UnMarked) "/" "INBOX"
? OK List completed.</pre>
<p>In folder INBOX contain all incoming messages. To select it: </p>
<pre>? SELECT INBOX
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted.
* 1 EXISTS
* 0 RECENT
* OK [UNSEEN 1] First unseen.
* OK [UIDVALIDITY 1253837819] UIDs valid
* OK [UIDNEXT 2] Predicted next UID
? OK [READ-WRITE] Select completed.</pre>
<p><em>1 EXISTS</em> &#8211; means 1 incoming message. You can choose between see full message or only message body instead:<br />
<em>? FETCH message_number All</em><br />
OR<br />
<em>? FETCH message_number Body</em></p>
<p>Let&#8217;s see whole message:</p>
<pre>? FETCH 1 all
* 1 FETCH (FLAGS () INTERNALDATE "25-Sep-2009 03:04:12 +0300" RFC822.SIZE 306 ENVELOPE ("Fri, 25 Sep 2009 03:04:08 +0300" NIL ((NIL NIL "fd" "test.com")) ((NIL NIL "fd" "test.com")) ((NIL NIL "fd" "test.com")) NIL NIL NIL NIL "<200909250004.n8ONtVLG011279@mail.test.com>"))
? OK Fetch completed.</pre>
<p>Exit user command  is <em>? LOGOUT</em>. </p>
<p>To learn more about IMAP refer to <a href="http://www.faqs.org/rfcs/rfc3501.html">RFC 3501</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/09/testing-imap-and-pop3-servers-over-the-telnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash hotkeys</title>
		<link>http://andriigrytsenko.net/2009/07/bash-hotkeys/</link>
		<comments>http://andriigrytsenko.net/2009/07/bash-hotkeys/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 08:39:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[*nix]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=333</guid>
		<description><![CDATA[Here is the table of bash hotkeys.




Hotkey
Function


ctrl-l
clear screen


ctrl-f
forward character


ctrl-b
back character


esc-b
move cursor back by one word


esc-f
move cursor forward by one word


ctrl-r
search backward starting at the current line and moving `up&#8217; through the history as necessary.


ctrl-s
search forward starting at the current line and moving `down&#8217; through the history as necessary.


ctrl-p
fetch the previous command from the history list, [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the table of bash hotkeys.</p>
<p><span id="more-333"></span></p>
<table border="1">
<tbody>
<tr>
<td>Hotkey</td>
<td>Function</td>
</tr>
<tr>
<td>ctrl-l</td>
<td>clear screen</td>
</tr>
<tr>
<td>ctrl-f</td>
<td>forward character</td>
</tr>
<tr>
<td>ctrl-b</td>
<td>back character</td>
</tr>
<tr>
<td>esc-b</td>
<td>move cursor back by one word</td>
</tr>
<tr>
<td>esc-f</td>
<td>move cursor forward by one word</td>
</tr>
<tr>
<td>ctrl-r</td>
<td>search backward starting at the current line and moving `up&#8217; through the history as necessary.</td>
</tr>
<tr>
<td>ctrl-s</td>
<td>search forward starting at the current line and moving `down&#8217; through the history as necessary.</td>
</tr>
<tr>
<td>ctrl-p</td>
<td>fetch the previous command from the history list, moving back in the list.</td>
</tr>
<tr>
<td>ctrl-n</td>
<td>fetch the next command from the history list, moving forward in the list.</td>
</tr>
<tr>
<td>esc-&lt;</td>
<td>move to the first line in the history.</td>
</tr>
<tr>
<td>esc-&gt;</td>
<td>Move to the end line in the history.</td>
</tr>
<tr>
<td>ctrl-u</td>
<td>clear all text from cursor to start of line</td>
</tr>
<tr>
<td>ctrl-a</td>
<td>move to the start of command</td>
</tr>
<tr>
<td>ctrl-e</td>
<td>move to the end of command</td>
</tr>
<tr>
<td>ctrl-w</td>
<td>clear one word back</td>
</tr>
<tr>
<td>esc-\</td>
<td>delete all spaces and tabs around point.</td>
</tr>
<tr>
<td>ctrl-y</td>
<td>yank last cleared word</td>
</tr>
<tr>
<td>esc-y</td>
<td>yank first cleared word</td>
</tr>
<tr>
<td>esc-?</td>
<td>list of possible completions of the text before point. (like double TAB)</td>
</tr>
<tr>
<td>esc-*</td>
<td>insert all possible completions into the line</td>
</tr>
<tr>
<td>ctrl-c</td>
<td>send signal SIGINT to the current process which is interrupt the command</td>
</tr>
<tr>
<td>ctrl-d</td>
<td>kills the shell</td>
</tr>
<tr>
<td>ctrl-h</td>
<td>delete one letter back</td>
</tr>
<tr>
<td>ctrl-z</td>
<td>put process into the background</td>
</tr>
<tr>
<td>esc-p</td>
<td>like ctrl-r lets you search through the previously given commands.</td>
</tr>
<tr>
<td>esc-.</td>
<td>gives the last command you typed.</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/07/bash-hotkeys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to get fully internet functionality from restricted environment over ssh</title>
		<link>http://andriigrytsenko.net/2009/07/how-to-get-fully-internet-functionality-from-restricted-environment-over-ssh/</link>
		<comments>http://andriigrytsenko.net/2009/07/how-to-get-fully-internet-functionality-from-restricted-environment-over-ssh/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 22:44:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[*nix]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[tunnels]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=229</guid>
		<description><![CDATA[If you working place don&#8217;t provide internet or provide very restricted access to web pages. But you want to feel free in the internet browsing.

For this you need:
1. At least one open port for output connection OR access to proxy.
2. Server in the internet with root OR user rights. 
You can easily get it in [...]]]></description>
			<content:encoded><![CDATA[<p>If you working place don&#8217;t provide internet or provide very restricted access to web pages. But you want to feel free in the internet browsing.<br />
<span id="more-229"></span></p>
<p>For this you need:<br />
1. At least one open port for output connection OR access to proxy.<br />
2. Server in the internet with root OR user rights. </p>
<p>You can easily get it in several simple steps. Just imagine that you located at office1 and open port for ongoing connection = 443. Also you have access to server1 which located at internet. Now go to server1 and edit ssh configuration file. Add new <em>port</em> directive into this file(in case if you have open port, in other case skip this step). Like this:</p>
<pre>server1# grep -i port /etc/ssh/sshd_config
Port 22
Port 443
</pre>
<p>As you can see now server1 use 2 ports(22 and 443) for ssh daemon. Let&#8217;s check it:</p>
<pre>server1# netstat -lnp | grep ssh
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      3946/sshd
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      3946/sshd
</pre>
<p>It&#8217;s ok. The next step #2 install proxy server. You can choose anyone you like. I chose tinyproxy, because of it&#8217;s very small and simple in configuration. </p>
<pre>server1# apt-get install tinyproxy </pre>
<p>It&#8217;s valid command for debian. For your distro use distro specific package manager as well. </p>
<p>Go to /etc/tinyproxy/tinyproxy.conf and check <em>port</em> and <em>listen</em> directives for determinate on which port and address your proxy listen. In my case it&#8217;s port 8888 on localhost: </p>
<pre>server1#grep -E "^(Port|Listen)"  /etc/tinyproxy/tinyproxy.conf
Port 8888
Listen 127.0.0.1</pre>
<p>Start daemon and check that it run: </p>
<pre>server1# /etc/init.d/tinyproxy start
server1# netstat -lnp | grep tinyproxy
tcp        0      127.0.0.1:8888              0.0.0.0:*               LISTEN      3923/tinyproxy</pre>
<p>Looks fine. Now make ssh tunnel to your server. If you have direct connection to server. Use this :</p>
<pre>server1#ssh -p 443 user@server#1 -L8888:127.0.0.01:8888 </pre>
<p>If not then do as described <a href="http://andriigrytsenko.net/2009/07/ssh-connection-via-http-proxy/">here</a>. </p>
<p>And last one step is setting up proxy 127.0.0.1:8888 on your browser and enjoy. </p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/07/how-to-get-fully-internet-functionality-from-restricted-environment-over-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH connection via http-proxy</title>
		<link>http://andriigrytsenko.net/2009/07/ssh-connection-via-http-proxy/</link>
		<comments>http://andriigrytsenko.net/2009/07/ssh-connection-via-http-proxy/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 07:59:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[*nix]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=150</guid>
		<description><![CDATA[How to get access to external server in the event of you can reach internet only over the http proxy server.

Sometimes I work in environment where I have no direct access to the internet. But I need to have connection to my remote server. For this purpose I use corkscrew software. In this post I&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<p>How to get access to external server in the event of you can reach internet only over the http proxy server.<br />
<span id="more-150"></span></p>
<p>Sometimes I work in environment where I have no direct access to the internet. But I need to have connection to my remote server. For this purpose I use corkscrew software. In this post I&#8217;ll try describe how it&#8217;s work. It&#8217;s very easy get in several step.</p>
<p>First of all we need to get corkscrew.</p>
<p>You cat get it in next way for debian:</p>
<pre># apt-get install corkscrew </pre>
<p>or download sources from <a href="http://www.agroman.net/corkscrew/">official site</a> and compile it for your distro:</p>
<pre>#tar -xzvf corkscrew-2.0.tar.gz
# [..]
#cd corkscrew
#./configure
#make install
</pre>
<p>It&#8217;s doesn&#8217;t matter which way you have chosen. </p>
<p>Add new string to your ssh_config to use this to all users at the system or in $HOME/.ssh/config. As I have proxy on host proxy_host which listened at port 8080 and want to use this rule only for me. That&#8217;s why I put next:  </p>
<pre>$ cat ~/.ssh/config
ProxyCommand corkscrew proxy_host 8080 %h %p</pre>
<p>Also if you should be authenticated at proxy side. You can simply add this feature. Just modify string in your config. </p>
<p>From:</p>
<pre>ProxyCommand corkscrew proxy_host 8080 %h %p</pre>
<p>To:</p>
<pre>ProxyCommand corkscrew proxy_host 8080 %h %p /path/to/auth_file</pre>
<p>And create /path/to/auth_file with next format : </p>
<pre>username:password</pre>
<p>Now I&#8217;ll try to check it:</p>
<pre>$ ssh -p 443 my_user@host.in.inet
my_user@host.in.inet's password:</pre>
<p>Ok I&#8217;ve got access to it :). Therefore I suspect everything work in proper way.</p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/07/ssh-connection-via-http-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
