
{"id":39473,"date":"2022-05-06T17:19:26","date_gmt":"2022-05-06T17:19:26","guid":{"rendered":"https:\/\/ubuntuhandbook.org\/?p=39473"},"modified":"2024-12-23T12:27:22","modified_gmt":"2024-12-23T12:27:22","slug":"share-folder-transfer-files-ubuntu","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2022\/05\/share-folder-transfer-files-ubuntu\/","title":{"rendered":"How to Share or Transfer Files over LAN in Ubuntu 22.04"},"content":{"rendered":"<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/11\/file-manager-icon.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-thumbnail wp-image-35890\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/11\/file-manager-icon-250x250.webp\" alt=\"\" width=\"250\" height=\"250\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/11\/file-manager-icon-250x250.webp 250w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/11\/file-manager-icon-300x300.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/11\/file-manager-icon-600x600.webp 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/11\/file-manager-icon-768x768.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/11\/file-manager-icon.webp 1200w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/p>\n<p>Want to share your files over local network or transfer file from one PC to another PC? Here are a few commonly used ways to do the job in Ubuntu 22.04 LTS.<\/p>\n<h3>Option 1: Share Folder Temporarily via Python scripts:<\/h3>\n<p><b>Without installing any package,<\/b> user may run a built-in Python script at any time to create a http file server for temporary use. Any device (Windows, Mac, Linux PC, and mobile phones) can access or download the files via a web browser.<\/p>\n<p><i>NOTE: This method seems to be not working good for transfer large files (1 GB+).<\/i><\/p>\n<p>1. First, right-click on the folder you want to share. Then click on &#8220;<b>Open in Terminal<\/b>&#8221; option in the context menu to open terminal.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/open-folder-terminal.webp\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-39474\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/open-folder-terminal-600x331.webp\" alt=\"\" width=\"600\" height=\"331\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/open-folder-terminal-600x331.webp 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/open-folder-terminal-300x166.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/open-folder-terminal-768x424.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/open-folder-terminal.webp 917w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>2. Next, run command to share this folder content over LAN via command:<\/p>\n<pre>python3 -m http.server<\/pre>\n<p>In case the default listening port 8000 is already in use, you may specify another port (9001 for example) via command:<\/p>\n<pre>python3 -m http.server 9001<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-39475\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/python-m-httpserver-600x149.webp\" alt=\"\" width=\"600\" height=\"149\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/python-m-httpserver-600x149.webp 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/python-m-httpserver-300x74.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/python-m-httpserver-768x191.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/python-m-httpserver.webp 786w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>Now, in any device&#8217;s web browser, go to <code>http:\/\/ubuntu-machine-ip:9001<\/code> (change the port accordingly, default is 8000). Click to open file directly or right-click and select &#8220;save as &#8230;&#8221; to download file.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-39477\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/python-httpserver-600x332.webp\" alt=\"\" width=\"600\" height=\"332\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/python-httpserver-600x332.webp 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/python-httpserver-300x166.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/python-httpserver-768x425.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/python-httpserver.webp 1067w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>To stop sharing the folder, either press <b>Ctrl+C<\/b> in terminal window or just close it.<\/p>\n<h3>Option 2: Use Dukto file transfer<\/h3>\n<p>If you transfer files regularly from one PC to another, then the open-source &#8220;Dukto&#8221; app is a good choice that works on Linux, MacOS, and Windows machines.<\/p>\n<p>Just open the app in both machines, it will detect each other automatically and offer options to transfer file\/folder, and send text.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-39478\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/dukto-sendingdata.png\" alt=\"\" width=\"352\" height=\"555\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/dukto-sendingdata.png 352w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/dukto-sendingdata-190x300.png 190w\" sizes=\"auto, (max-width: 352px) 100vw, 352px\" \/><\/p>\n<p>Though the app has not been updated for years, it&#8217;s still working very well! Mac and Windows users may download &amp; install the app packages from:<\/p>\n<div class=\"wp-block-buttons aligncenter\">\n<div class=\"wp-block-button is-style-fill\"><a class=\"wp-block-button__link has-vivid-cyan-blue-to-vivid-purple-gradient-background has-text-color has-background\" href=\"https:\/\/sourceforge.net\/projects\/dukto\/files\/\" target=\"_blank\" rel=\"noreferrer noopener\">Download Dukto (Windows &amp; Mac)<\/a><\/div>\n<\/div>\n<p>For Ubuntu user, the package in previous link does not install due to dependency issue. However, the Qt6 port from this <a href=\"https:\/\/launchpad.net\/~xuzhen666\/+archive\/ubuntu\/dukto\/\" target=\"_blank\" rel=\"noopener\">Ubuntu PPA<\/a> is available for all current Ubuntu releases.<\/p>\n<p>Simply open terminal by pressing Ctrl+Alt+T on keyboard, and run following commands one by one will add the PPA and install Dukto in Ubuntu:<\/p>\n<pre>sudo add-apt-repository ppa:xuzhen666\/dukto<\/pre>\n<pre>sudo apt update<\/pre>\n<pre>sudo apt install dukto<\/pre>\n<h3>Option 3: Share Folder via Samba<\/h3>\n<p>If you want to share a folder for long time use, it&#8217;s better to use the samba file sharing service. This can be done easily in Ubuntu, since &#8220;Files&#8221; (Nautilus file manager) provides a context menu option to do the job.<\/p>\n<p>1.) Firstly, right-click on the folder you want to share. Then, click on the &#8220;<b>Local Network Share<\/b>&#8221; menu option.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-39482\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/network-share-option-600x331.webp\" alt=\"\" width=\"600\" height=\"331\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/network-share-option-600x331.webp 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/network-share-option-300x166.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/network-share-option-768x424.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/network-share-option.webp 917w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>2.) In the pop-up dialog, enable the checkbox which says &#8220;Share this folder&#8221;.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-39481\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/first-enable.png\" alt=\"\" width=\"445\" height=\"435\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/first-enable.png 445w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/first-enable-300x293.png 300w\" sizes=\"auto, (max-width: 445px) 100vw, 445px\" \/><\/p>\n<p>3.) If you&#8217;re doing this for the first time, it will prompt to install the samba sharing service.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-39483\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/install-sharing-service-600x169.webp\" alt=\"\" width=\"600\" height=\"169\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/install-sharing-service-600x169.webp 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/install-sharing-service-300x85.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/install-sharing-service.webp 646w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>Just click &#8220;Install service&#8221; and confirm in next dialog to install the required packages.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-39484\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/samba-confirminstall.png\" alt=\"\" width=\"524\" height=\"447\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/samba-confirminstall.png 524w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/samba-confirminstall-300x256.png 300w\" sizes=\"auto, (max-width: 524px) 100vw, 524px\" \/><\/p>\n<p>4.) After installing them, go back to the previous dialog in step 1.). Enable &#8220;Share this folder&#8221; and tick &#8220;Guest access&#8221; and &#8220;Allow others to create and delete &#8230;&#8221; accordingly.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-39485\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/final-enableshare.png\" alt=\"\" width=\"445\" height=\"435\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/final-enableshare.png 445w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/final-enableshare-300x293.png 300w\" sizes=\"auto, (max-width: 445px) 100vw, 445px\" \/><\/p>\n<p>If you enabled the write permission (<i>&#8220;Allow others to create and delete &#8230;&#8221;<\/i>), it will prompt to change the folder permissions.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-39486\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/permission-confirm-600x235.webp\" alt=\"\" width=\"600\" height=\"235\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/permission-confirm-600x235.webp 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/permission-confirm-300x118.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/permission-confirm.webp 648w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>5.) If you got &#8220;&#8216;network share&#8217; return 255&#8221; error, open terminal (Ctrl+Alt+T) and run command to add current user to &#8216;sambashare&#8217; group should fix the issue after logged out and back in.<\/p>\n<pre>sudo gpasswd --add $USER sambashare<\/pre>\n<p>And, if you didn&#8217;t enable guest access then a <b>separated password has to be added for authentication:<\/b><\/p>\n<pre>sudo smbpasswd -a $USER<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-39487\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/sambapasswd-600x188.webp\" alt=\"\" width=\"600\" height=\"188\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/sambapasswd-600x188.webp 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/sambapasswd-300x94.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/sambapasswd-768x240.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/sambapasswd.webp 786w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<h4>To access this samba share:<\/h4>\n<p>For <b>Windows<\/b> user, press <b>Window key + R<\/b> on keyboard to open &#8220;Run&#8221; box, and type <code>\\\\ubuntu-machine-ip<\/code>. Then type username and password you set in previous step to access this folder.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-39488\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/remote-folder.png\" alt=\"\" width=\"422\" height=\"251\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/remote-folder.png 422w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/05\/remote-folder-300x178.png 300w\" sizes=\"auto, (max-width: 422px) 100vw, 422px\" \/><\/p>\n<p>For Linux user (only tested in GNOME), open &#8220;Files -&gt; Other Locations&#8221; and type <code>smb:\/\/ubuntu-machine-ip<\/code> in button to connect.<\/p>\n<p>For MacOS, press <b>command + K<\/b> on keyboard to open Connect to Server dialog, type <code>smb:\/\/ubuntu-machine-ip<\/code> and hit Enter to access.<\/p>","protected":false},"excerpt":{"rendered":"<p>Want to share your files over local network or transfer file from one PC to another PC? Here are a few commonly used ways to do the job in Ubuntu 22.04 LTS. Option 1: Share Folder Temporarily via Python scripts: Without installing any package, user may run a built-in Python script at any time to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":35890,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[1317],"class_list":["post-39473","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","tag-network"],"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/39473","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/comments?post=39473"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/39473\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media\/35890"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=39473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=39473"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=39473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}