<?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>Archiwa sshfs - soban</title>
	<atom:link href="https://soban.pl/category/sshfs/feed/" rel="self" type="application/rss+xml" />
	<link>https://soban.pl/category/sshfs/</link>
	<description>IT, Linux, Servers, Security</description>
	<lastBuildDate>Sat, 25 Feb 2023 22:12:35 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>
	<item>
		<title>sshfs great tool to mount remote file system</title>
		<link>https://soban.pl/sshfs-great-tool-to-mount-remote-file-system/</link>
		
		<dc:creator><![CDATA[soban]]></dc:creator>
		<pubDate>Fri, 22 Oct 2021 13:30:45 +0000</pubDate>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Kali]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[sshfs]]></category>
		<guid isPermaLink="false">https://soban.pl/?p=243</guid>

					<description><![CDATA[<p>SSHFS (SSH File System) is a secure file transfer system that enables users to remotely access and manage files on a remote server over an encrypted SSH (Secure Shell) connection. SSHFS uses the SSH protocol to establish a secure connection between the local and remote systems, which enables users to securely transfer files between the [&#8230;]</p>
<p>Artykuł <a href="https://soban.pl/sshfs-great-tool-to-mount-remote-file-system/">sshfs great tool to mount remote file system</a> pochodzi z serwisu <a href="https://soban.pl">soban</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>SSHFS (SSH File System) is a secure file transfer system that enables users to remotely access and manage files on a remote server over an encrypted SSH (Secure Shell) connection. SSHFS uses the SSH protocol to establish a secure connection between the local and remote systems, which enables users to securely transfer files between the two systems.</p>



<p>To use SSHFS, the user needs to have SSHFS installed on their local system as well as the remote system that they want to connect to. Once SSHFS is installed, the user can mount the remote system as a local directory on their system, and access the remote files as if they were stored locally.</p>



<p>SSHFS provides a secure and convenient way to access and manage files on remote systems, without the need for additional software or complicated configuration. It also enables users to access files on remote systems using standard file operations, such as copying, moving, and deleting, making it a simple and effective way to manage files on remote systems.</p>



<p><strong><strong>SSH Filesystem</strong></strong> (<strong>sshfs</strong>) is a very useful tool for remotely transferring files over the ssh protocol. An additional advantage of the whole is encryption. This is a convenient way to mount a remote folder to delete files. Below I will try to briefly introduce how to install sshfs and how to mount the folder remotely. Additionally, we will make an entry in <strong>/etc/fstab</strong> at the end, so that the resource itself is mounted after restarting the system. Let&#8217;s move on to installing the tool itself: </p>



<div class="wp-block-urvanov-syntax-highlighter-code-block"><pre class="urvanov-syntax-highlighter-plain-tag"># apt install sshfs</pre></div>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="432" src="https://soban.pl/wp-content/uploads/2021/10/image-82-1024x432.png" alt="" class="wp-image-244" srcset="https://soban.pl/wp-content/uploads/2021/10/image-82-1024x432.png 1024w, https://soban.pl/wp-content/uploads/2021/10/image-82-300x127.png 300w, https://soban.pl/wp-content/uploads/2021/10/image-82-768x324.png 768w, https://soban.pl/wp-content/uploads/2021/10/image-82.png 1128w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>In this case, as you can see, the installation was done on kali linuxe, however the procedure is the same on debian.</p>



<p>Let&#8217;s move on to the file mounting itself, at this point I will point out that the default port is 22. In my case, however, the port has been changed to 2222. For services such as ssh, I try to change the default ports so as not to get caught by bots and not end up in the database such as <a href="https://www.shodan.io/" target="_blank" rel="noreferrer noopener">shodan.io</a>. The command itself in this case is very simple, but first we need to create a folder: </p>



<div class="wp-block-urvanov-syntax-highlighter-code-block"><pre class="urvanov-syntax-highlighter-plain-tag">$ mkdir /home/kali/myremotedir</pre></div>



<figure class="wp-block-image size-full"><img decoding="async" width="402" height="65" src="https://soban.pl/wp-content/uploads/2021/10/image-83.png" alt="" class="wp-image-245" srcset="https://soban.pl/wp-content/uploads/2021/10/image-83.png 402w, https://soban.pl/wp-content/uploads/2021/10/image-83-300x49.png 300w" sizes="(max-width: 402px) 100vw, 402px" /></figure>



<p>Let&#8217;s try to mount a remote folder:</p>



<div class="wp-block-urvanov-syntax-highlighter-code-block"><pre class="urvanov-syntax-highlighter-plain-tag">$ sshfs soban@soban.pl:/home/soban/ /home/kali/myremotedir -p 2222</pre></div>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="148" src="https://soban.pl/wp-content/uploads/2021/10/image-84-1024x148.png" alt="" class="wp-image-246" srcset="https://soban.pl/wp-content/uploads/2021/10/image-84-1024x148.png 1024w, https://soban.pl/wp-content/uploads/2021/10/image-84-300x43.png 300w, https://soban.pl/wp-content/uploads/2021/10/image-84-768x111.png 768w, https://soban.pl/wp-content/uploads/2021/10/image-84.png 1089w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>During mounting, we will be asked if the fingerprint is correct. Then for the system password. The command itself can be disassembled into &#8216;<strong>soban</strong>&#8216; &#8211; this is the username. Then &#8216;<strong>soban.pl</strong>&#8216; is the domain name, you can also put the IP address here. The next &#8216;<strong>/home/soban</strong>&#8216; element is the folder that will be mounted. And after the space &#8216;<strong>/home/kali/myremotedir</strong>&#8216; we give the folder where the remote folder should be mounted. If everything went as planned, we can list &#8216;<strong>/home/kali/myremotedir</strong>&#8216; and it should list the contents of the remotely mounted folder &#8216;<strong>/home/soban</strong>&#8216;. Let&#8217;s list the contents of the &#8216;<strong>/home/kali/myremotedir</strong>&#8216; folder:</p>



<div class="wp-block-urvanov-syntax-highlighter-code-block"><pre class="urvanov-syntax-highlighter-plain-tag">$ ls -ltr /home/kali/myremotedir</pre></div>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="642" height="159" src="https://soban.pl/wp-content/uploads/2021/10/image-85.png" alt="" class="wp-image-247" srcset="https://soban.pl/wp-content/uploads/2021/10/image-85.png 642w, https://soban.pl/wp-content/uploads/2021/10/image-85-300x74.png 300w" sizes="auto, (max-width: 642px) 100vw, 642px" /></figure>



<p>Let&#8217;s create a remote file:</p>



<div class="wp-block-urvanov-syntax-highlighter-code-block"><pre class="urvanov-syntax-highlighter-plain-tag">$ echo 'some text' &gt; /home/kali/myremotedir/example
$ ls -ltr /home/kali/myremotedir</pre></div>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="664" height="259" src="https://soban.pl/wp-content/uploads/2021/10/image-86.png" alt="" class="wp-image-248" srcset="https://soban.pl/wp-content/uploads/2021/10/image-86.png 664w, https://soban.pl/wp-content/uploads/2021/10/image-86-300x117.png 300w" sizes="auto, (max-width: 664px) 100vw, 664px" /></figure>



<p>Now let&#8217;s unmount the remote folder and try listing it again:</p>



<div class="wp-block-urvanov-syntax-highlighter-code-block"><pre class="urvanov-syntax-highlighter-plain-tag">$ umount /home/kali/myremotedir
$ ls -ltr /home/kali/myremotedir</pre></div>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="445" height="155" src="https://soban.pl/wp-content/uploads/2021/10/image-87.png" alt="" class="wp-image-249" srcset="https://soban.pl/wp-content/uploads/2021/10/image-87.png 445w, https://soban.pl/wp-content/uploads/2021/10/image-87-300x104.png 300w" sizes="auto, (max-width: 445px) 100vw, 445px" /></figure>



<p>As expected, the folder is empty and the file we created was created on a remotely mounted drive. After unmounting as you can see the file &#8216;<strong>/home/kali/myremotedir/example</strong>&#8216;.</p>



<p>The next step is to create a private key to mount the folder without entering a password. It is very important not to send nikmou your private key. How we can generate and add a public key to a remote server can be read here: &#8220;<a href="https://soban.pl/generate-ssh-key-pair-in-linux/" target="_blank" rel="noreferrer noopener">Generate SSH key pair in Linux</a>&#8220;.</p>



<p>Now we will try to add an entry to <strong>/etc/fstab</strong> which will allow automatic mounting on startup of the remote folder system.<br>To do this, edit the <strong>/etc/fstab</strong> entry and add this entry:</p>



<div class="wp-block-urvanov-syntax-highlighter-code-block"><pre class="urvanov-syntax-highlighter-plain-tag">#edit this entry and put correct data
sshfs#soban@soban.pl:/home/soban /home/kali/myremotedir fuse auto,user,_netdev,reconnect,identityfile=/home/kali/.ssh/id_rsa,port=2222,uid=1000,gid=1000,allow_other 0 0</pre></div>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="245" src="https://soban.pl/wp-content/uploads/2021/10/image-92-1024x245.png" alt="" class="wp-image-259" srcset="https://soban.pl/wp-content/uploads/2021/10/image-92-1024x245.png 1024w, https://soban.pl/wp-content/uploads/2021/10/image-92-300x72.png 300w, https://soban.pl/wp-content/uploads/2021/10/image-92-768x184.png 768w, https://soban.pl/wp-content/uploads/2021/10/image-92-1536x367.png 1536w, https://soban.pl/wp-content/uploads/2021/10/image-92.png 1698w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>It is important that all data is correct, in order to verify the parameters, you can use the command for this &#8216;<strong>id</strong>&#8216;:</p>



<div class="wp-block-urvanov-syntax-highlighter-code-block"><pre class="urvanov-syntax-highlighter-plain-tag"># id kali</pre></div>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="100" src="https://soban.pl/wp-content/uploads/2021/10/image-94-1024x100.png" alt="" class="wp-image-261" srcset="https://soban.pl/wp-content/uploads/2021/10/image-94-1024x100.png 1024w, https://soban.pl/wp-content/uploads/2021/10/image-94-300x29.png 300w, https://soban.pl/wp-content/uploads/2021/10/image-94-768x75.png 768w, https://soban.pl/wp-content/uploads/2021/10/image-94.png 1067w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>Now we can move on to mounting the resource:</p>



<div class="wp-block-urvanov-syntax-highlighter-code-block"><pre class="urvanov-syntax-highlighter-plain-tag"># mount /home/kali/myremotedir</pre></div>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="895" height="118" src="https://soban.pl/wp-content/uploads/2021/10/image-93.png" alt="" class="wp-image-260" srcset="https://soban.pl/wp-content/uploads/2021/10/image-93.png 895w, https://soban.pl/wp-content/uploads/2021/10/image-93-300x40.png 300w, https://soban.pl/wp-content/uploads/2021/10/image-93-768x101.png 768w" sizes="auto, (max-width: 895px) 100vw, 895px" /></figure>



<p>When mounting for the first time, we may be asked to accept and confirm that the fingerprint is correct. After verifying the correctness of mounting the remote resource, we can restart the system. One note here, the system may get up longer.</p>
<p>Artykuł <a href="https://soban.pl/sshfs-great-tool-to-mount-remote-file-system/">sshfs great tool to mount remote file system</a> pochodzi z serwisu <a href="https://soban.pl">soban</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
