<?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>create socks with ssh &#8211; lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</title>
	<atom:link href="https://lifelinux.com/tag/create-socks-with-ssh/feed/" rel="self" type="application/rss+xml" />
	<link>https://lifelinux.com</link>
	<description>All About Linux !</description>
	<lastBuildDate>Tue, 16 Feb 2016 07:01:27 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.5.15</generator>
	<item>
		<title>How To Create Socks (SSH Tunneling) As A Service By SSH Command On CentOS</title>
		<link>https://lifelinux.com/how-to-create-socks-ssh-tunneling-as-a-service-by-ssh-command-on-centos/</link>
					<comments>https://lifelinux.com/how-to-create-socks-ssh-tunneling-as-a-service-by-ssh-command-on-centos/#respond</comments>
		
		<dc:creator><![CDATA[Unix]]></dc:creator>
		<pubDate>Tue, 16 Feb 2016 06:58:51 +0000</pubDate>
				<category><![CDATA[Bash Shell]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[create socks with ssh]]></category>
		<category><![CDATA[create socks5]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=2108</guid>

					<description><![CDATA[<p>This guide will show you how to establish a secure connection for browsing the web through a tunnel between your computer and your server. With this method, you will set up a tunnel between your computer and your server. All your web traffic will be encrypted and forwarded from your server on to its final [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://lifelinux.com/how-to-create-socks-ssh-tunneling-as-a-service-by-ssh-command-on-centos/">How To Create Socks (SSH Tunneling) As A Service By SSH Command On CentOS</a> appeared first on <a rel="nofollow" href="https://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>This guide will show you how to establish a secure connection for browsing the web through a tunnel between your computer and your server. With this method, you will set up a tunnel between your computer and your server. All your web traffic will be encrypted and forwarded from your server on to its final destination.<br />
<span id="more-2108"></span></p>
<p>Socket Secure (SOCKS) is an Internet protocol that exchanges network packets between a client and server through a proxy server. SOCKS5 additionally provides authentication so only authorized users may access a server. Practically, a SOCKS server proxies TCP connections to an arbitrary IP address, and provides a means for UDP packets to be forwarded.</p>
<p>It works by launching a SOCKS proxy server on your computer using SSH. It will listen on a local port and your browser will connect to the web using that service.</p>
<h2>Creating the SOCKS Server</h2>
<p>The first step is to create the SOCKS server and establish a connection to your server with following command</p>
<pre># ssh -fNT -D &lt;your_ip_server&gt;:&lt;define_socks_port&gt; &lt;user_name&gt;@&lt;your_ip_server&gt;
</pre>
<p><strong>Options</strong><br />
-f: go to background<br />
-N: do not execute a remote program<br />
-T: disable pseudo-tty allocation<br />
-D: Define port forwarding and talks to the clients via SOCSK5 or SOCKS4 protocols</p>
<h2>Running as a service</h2>
<p>The first, Create a user called name &#8220;socks&#8221; and setup this account login to your server via SSH private key without password.</p>
<pre># useradd socks
</pre>
<p>To setup this account login your service via SSH private key, please read this <a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2">article</a></p>
<p>The second, Login with socks and type the following command</p>
<pre># mkdir /opt/socks
# chown root.root -R /opt/socks
# chmod 700 /opt/socks
# touch /opt/socks/run.sh
# chmod +x /opt/socks/run.sh
# cp -R /home/socks/.ssh/id_rsa /opt/socks/
</pre>
<p>Append bellow content to /opt/socks/run.sh</p>
<pre>#/bin/bash
IPS="1.1.1.1 2.2.2.2 3.3.3.3"
SOCKS_PORT=9999
SSH_PORT=22
SSH_USER=socks

# Auto get list IPs on your server
# IPS=`ifconfig | grep "inet a" | awk '{print $2}' | grep -v "127.0" | cut -d: -f2`

for IP in $IPS
do
        echo "Building socks $IP"
        ssh -D $IP:$SOCKS_PORT -fN -p $SSH_PORT  -i /opt/socks/id_rsa $SSH_USER@$IP
done
</pre>
<g:plusone href="https://lifelinux.com/how-to-create-socks-ssh-tunneling-as-a-service-by-ssh-command-on-centos/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="https://lifelinux.com/how-to-create-socks-ssh-tunneling-as-a-service-by-ssh-command-on-centos/">How To Create Socks (SSH Tunneling) As A Service By SSH Command On CentOS</a> appeared first on <a rel="nofollow" href="https://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lifelinux.com/how-to-create-socks-ssh-tunneling-as-a-service-by-ssh-command-on-centos/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
