How to transfer files between pcs on same network

Technical issues/questions of an intermediate or advanced nature.
User avatar
Ed_P
Contributor
Contributor
Posts: 8955
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

How to transfer files between pcs on same network

Post#16 by Ed_P » 03 Oct 2019, 15:53

:)
burdi01 wrote:
03 Oct 2019, 10:24
the crux of your problem is this "Without adding anything to it". And is that "it" your Windows box, your Linux one or both?
The Windows 7 box. It works as is with Windows 10.
burdi01 wrote:
03 Oct 2019, 10:24
From Linux you should be able to access that share via "mount -t cifs ..." and upload to it without adding anything to either one of boxes.
:o I like the sound of "cifs". :good: I will check it out. Thank you. :beer:

-update-

hmmm Porteus has a mount.cifs command. :o

User avatar
Blaze
DEV Team
DEV Team
Posts: 3998
Joined: 28 Dec 2010, 11:31
Distribution: ⟰ Porteus current ☯ all DEs ☯
Location: ☭ Russian Federation, Lipetsk region, Dankov
Contact:

How to transfer files between pcs on same network

Post#17 by Blaze » 03 Oct 2019, 17:04

Linux 6.6.11-porteus #1 SMP PREEMPT_DYNAMIC Sun Jan 14 12:07:37 MSK 2024 x86_64 Intel(R) Xeon(R) CPU E3-1270 v6 @ 3.80GHz GenuineIntel GNU/Linux
MS-7A12 » [AMD/ATI] Navi 23 [Radeon RX 6600] [1002:73ff] (rev c7) » Vengeance LPX 16GB DDR4 K2 3200MHz C16

User avatar
Ed_P
Contributor
Contributor
Posts: 8955
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

How to transfer files between pcs on same network

Post#18 by Ed_P » 03 Oct 2019, 20:55

:jump: :bounce8: :jump: :Yahoo!:

mount.cifs and umount work. :worship: Thank you guys. :beer:

Minor question, the Windows 7 system doesn't require a signon, mount.cifs asks for a password regardless. I tried pass= and pass="" but neither worked. Suggestion.

Shadow0815
Black ninja
Black ninja
Posts: 33
Joined: 16 Jul 2015, 03:50
Distribution: Porteus,Xubuntu,Arch
Location: DE

How to transfer files between pcs on same network

Post#19 by Shadow0815 » 03 Oct 2019, 23:45

burdi01 wrote:
03 Oct 2019, 10:24
In the "Shadow0815" case you are add something to your Linux box and then go to the Windows box to download via that Linux something. I think using an FTP server as that Linux something would be the simplest option then.
That something is a simple http webserver build into python 2 or 3 serving the current working directory and its subdirs.

You can have it running under windows too.

In windows:
install cygwin and cygwin-packages (during cygwin-setup): python 3 or 2 and qrencode if you want qr-code generation



update code snippet:

Code: Select all

serve -qr
will now generate qr code for easy access with phone/tablet
needs qrencode:

Code: Select all

su
usm -u all
usm -g qrencode

Code: Select all

# put in: ~/.bashrc

myip-lan()
{
	if type nmcli 1>/dev/null 2>&1; then
		ip=$(nmcli -p device show|grep -i 'IP4\.ADDRESS'|grep -v '127\.0\.0\.1'|sed 's;/24;;g'|awk '{print $2}');
	elif type /sbin/ip 1>/dev/null 2>&1; then
		ip=$(/sbin/ip a|grep "inet "|grep -iv "host lo"|sed 's;/24;;g'|awk '{print $2}')
	elif type cygstart.exe 1>/dev/null 2>&1; then
		ip=$(ipconfig|grep -i 'IPv4 Address'|head -1|sed 's/^[^:]*://g')
	fi
	# remove all whitespace characters from possible unclean output in ip variable
    ip="$(echo -e "$ip" | tr -d '[:space:]')"
    echo $ip
}


serve()
{
url="http://$(myip-lan):8000"
	echo "---------------------------"
	echo "Connect to:"
	echo "$url"
	echo "---------------------------"
	echo ""

if [ "$1" == "-qr" ]; then
	if command -v qrencode >/dev/null 2>&1; then
			png="/tmp/serve-url-qrcode.png"
			qrencode -o "$png" "$url"
			command -v xdg-open >/dev/null 2>&1 && xdg-open "$png" &
			command -v cygstart.exe >/dev/null 2>&1 && cygstart.exe "$png" &
		else
			printf >&2 "\n-----\nMISSING qrencode, no qr code generated!\n-----\n"
	fi;
fi

    if command -v python3 >/dev/null 2>&1; then
        python3 -m http.server;
    elif command -v python2 >/dev/null 2>&1; then
		python2 -m SimpleHTTPServer;
    fi
}

My bash-snippet was tested under Porteus and Windows7 with Cygwin



Ed_P wrote:
03 Oct 2019, 20:55
Minor question, the Windows 7 system doesn't require a signon, mount.cifs asks for a password regardless. I tried pass= and pass="" but neither worked. Suggestion.

Code: Select all

mount -t cifs //my.host/mydir  -o user=,password= /mnt/samba
https://www.thinkplexx.com/learn/howto/ ... t-password

User avatar
Ed_P
Contributor
Contributor
Posts: 8955
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

How to transfer files between pcs on same network

Post#20 by Ed_P » 04 Oct 2019, 00:36

Shadow0815 wrote:
03 Oct 2019, 23:45
Ed_P wrote:
03 Oct 2019, 20:55
Minor question, the Windows 7 system doesn't require a signon, mount.cifs asks for a password regardless. I tried pass= and pass="" but neither worked. Suggestion.

Code: Select all

mount -t cifs //my.host/mydir  -o user=,password= /mnt/samba
https://www.thinkplexx.com/learn/howto/ ... t-password
Thank you :worthy: Shadow0815. I will try this the next time I have the Windows 7 system up. The cifs and umount system works without my having to add anything to my Porteus or Windows 7 systems. :celebrate14: :thumbsup:

-Update-

:Yahoo!: user=,password= works, No more password prompt. :good: :beer:

Code: Select all

mount.cifs $REMOTE -o user=,password= $LOCAL
cp $UPLOAD/$FILE $LOCAL/
umount $LOCAL
(I haven't tried it yet but I think this approach works for uploads and downloads!)

User avatar
Ed_P
Contributor
Contributor
Posts: 8955
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

How to transfer files between pcs on same network

Post#21 by Ed_P » 06 Oct 2019, 23:13

Shadow0815 wrote:
03 Oct 2019, 23:45
My bash-snippet was tested under Porteus and Windows7 with Cygwin
What did I do wrong?

Code: Select all

guest@porteus:~$ su
Password: 
root@porteus:/home/guest# ls /.bashrc
/bin/ls: cannot access '/.bashrc': No such file or directory

root@porteus:/home/guest# myip-lan()
> {
> if type nmcli 1>/dev/null 2>&1; then
> 
Display all 2587 possibilities? (y or n)
> mcli -p device show|grep -i 'IP4\.ADDRESS'|grep -v '127\.0\.0\.1'|sed 's;/24;;g'|awk '{print $2}');
bash: syntax error near unexpected token `)'
root@porteus:/home/guest# elif type /sbin/ip 1>/dev/null 2>&1; then
bash: syntax error near unexpected token `elif'
root@porteus:/home/guest# 
Display all 2587 possibilities? (y or n)
root@porteus:/home/guest# /ip a|grep "inet "|grep -iv "host lo"|sed 's;/24;;g'|awk '{print $2}')
bash: syntax error near unexpected token `)'
root@porteus:/home/guest# elif type cygstart.exe 1>/dev/null 2>&1; then
bash: syntax error near unexpected token `elif'
root@porteus:/home/guest# 
Display all 2587 possibilities? (y or n)
root@porteus:/home/guest# fig|grep -i 'IPv4 Address'|head -1|sed 's/^[^:]*://g')bash: syntax error near unexpected token `)'
root@porteus:/home/guest# fi
bash: syntax error near unexpected token `fi'
root@porteus:/home/guest# # remove all whitespace characters from possible unclean output in ip variable
root@porteus:/home/guest#     ip="$(echo -e "$ip" | tr -d '[:space:]')"
root@porteus:/home/guest#     echo $ip

root@porteus:/home/guest# }
bash: syntax error near unexpected token `}'
root@porteus:/home/guest# 
root@porteus:/home/guest# 
root@porteus:/home/guest# serve()
> {
> url="http://$(myip-lan):8000"
> echo "---------------------------"
> echo "Connect to:"
> echo "$url"
> echo "---------------------------"
> echo ""
> 
> if [ "$1" == "-qr" ]; then
> if command -v qrencode >/dev/null 2>&1; then
> 
Display all 2587 possibilities? (y or n)
> g="/tmp/serve-url-qrcode.png"
> 
Display all 2587 possibilities? (y or n)
> code -o "$png" "$url"
> 
Display all 2587 possibilities? (y or n)
> d -v xdg-open >/dev/null 2>&1 && xdg-open "$png" &
> 
Display all 2587 possibilities? (y or n)
> d -v cygstart.exe >/dev/null 2>&1 && cygstart.exe "$png" &
> 
Display all 2587 possibilities? (y or n)
> tf >&2 "\n-----\nMISSING qrencode, no qr code generated!\n-----\n"
bash: !\n: event not found
> fi;
> fi
> 
>     if command -v python3 >/dev/null 2>&1; then
>         python3 -m http.server;
>     elif command -v python2 >/dev/null 2>&1; then
> 
Display all 2587 possibilities? (y or n)
!                                      mkfs.ext4
./                                     mkfs.ext4dev
2to3                                   mkfs.f2fs
2to3-3.6                               mkfs.fat
7z                                     mkfs.minix
7zFM                                   mkfs.msdos
7zG                                    mkfs.ntfs
7za                                    mkfs.reiserfs
7zr                                    mkfs.vfat
:                                      mkfs.xfs
Client7z                               mkhomedir_helper
ControlPanel                           mkhybrid
LzmaCon                                mkisofs
ModemManager                           mklost+found
NetworkManager                         mkmanifest
X                                      mknod
Xdialog                                mkntfs
Xorg                                   mkpasswd
Xvnc                                   mkreiserfs
[                                      mksquashfs
[[                                     mkswap
]]                                     mktemp
a52dec                                 mktemp-gnu
> 2 -m SimpleHTTPServer;
>     fi
> }
:%)

I don't have grencode.

Code: Select all

root@porteus:/home/guest# usm -i qrencode

 The following items were found.
 Choose an number to confirm. 
 ctrl+c to quit

1) qrencode-3.4.4-x86_64-1alien.txz    3) qrencode-3.4.2-x86_64-1_slonly.txz
2) qrencode-4.0.2-x86_64-1ponce.txz
#? 1

Package:  qrencode-3.4.4-x86_64-1alien.txz  (56 K) [not installed]
qrencode: qrencode (library for encoding data into QR Code)
qrencode:
qrencode:  Libqrencode is a library for encoding data in a QR Code symbol,
qrencode: a kind of 2D symbology that can be scanned by handy terminals such as
qrencode: a mobile phone with CCD.
qrencode: The capacity of QR Code is up to 7000 digits or 4000 characters,
qrencode: and has high robustness.
qrencode:
qrencode:
qrencode: qrencode home: http://fukuchi.org/works/qrencode/index.en.html
qrencode:

root@porteus:/home/guest# 

rych
Warlord
Warlord
Posts: 787
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

How to transfer files between pcs on same network

Post#22 by rych » 02 Jun 2024, 11:16

Choosing between Samba and NFS in 2024 ... I've chosen the Syncthing https://syncthing.net/ for now

It's because what I really want is a local synchronized copy of the remote folder, rather than having it mounted. Syncthing is an instant install for both Porteus (simply unpack and run the syncthing-linux-amd64-v1.27.7.tar.gz) and Windows .exe installer. It has a web GUI. Start the Syncthing on both machines and pair them using 2 Device IDs. Then share folders with a unique Folder ID. Each instance is scanned and starts a 2-way syncing. I'm yet to see how it resolves conflicts and quite disturbingly it's now re-syncing entire folder previously synched with GoodSync run when I physically plugged the Porteus USB into the Windows machine... will report here further observations...

Among optional security settings, I find the 4 in the Settings-Connections Tab most relevant, which for my LAN sharing scenario, I've chosen as follows :

Enable NAT traversal -- off
Global Discovery -- off
Local Discovery -- on
Enable Relaying -- off -- lest your network admin complains that you machine relay foreign traffic

It took a half-minute (why so long?) for the 2 machines on my LAN to find each other and pair. Then it took about 5min to sync the pair of 20GB folders. Strangely, it showed some network transfers while syncing even though as I said above the 2 folders had previously been synched by GoodSync... I'll see what GoodSync is going to say about equality of the files now, but Syncthing would be my preferred synching method as it doesn't involve any USB plugging or setting up Samba or NFS client-server.

UPDATE: GoodSync confirms folders equal after Syncthing. But not the other way around: Syncthing reports folders Out of Sync after they were synched by GoodSync. More issues in the following posts.
Last edited by rych on 03 Jun 2024, 11:20, edited 1 time in total.

i3slkiller
Contributor
Contributor
Posts: 129
Joined: 03 Feb 2020, 18:51
Distribution: Debian 12, Porteus 5.01
Location: Poland

How to transfer files between pcs on same network

Post#23 by i3slkiller » 02 Jun 2024, 12:52

@rych Very good software, I'm using it since version 1.4.0 :good:
BTW I will also mention about SyncthingTray https://github.com/Martchus/syncthingtray You can see folder/device status and recently changed files without opening syncthing web UI.

rych
Warlord
Warlord
Posts: 787
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

How to transfer files between pcs on same network

Post#24 by rych » 03 Jun 2024, 12:21

i3slkiller wrote:
02 Jun 2024, 12:52
SyncthingTray
Thank you. It's successfully registered into my OpenBox Tint2 tray and connected to Syncthing. On Windows machine though it couldn't find the running instance of Syncthing... I'll look into it later.

Now I have a more important, Connection issue. I spoke too soon and easy about Local Discovery. It doesn't actually seem to work in my case. And I'm afraid it won't be fixed by changing "dynamic" address to the local 192.168.1.* addresses. I have what is called "segregated" subnetworks? My Porteus machine doesn't have a WiFi adapter, so I plug an Android phone into its USB port and use USB Tethering on it.

Porteus machine is seen by Windows machine as a local, and shows connection type as "TCP LAN". However, Porteus sees Windows server mapped into the sub-local sub-network created by the Android-phone&Porteus server and the connection type is "TCP WAN". It shows the Windows server to be on 192.168.1.85, while it's true address assigned by my WiFi is 192.168.1.90 :) Android USB Tethering port mapping at play here I guess. Described here for example


For them to find each other, I had to enable Global Dicovery on Porteus server (Windows server still uses Local Discovery only): otherwise they simply can't connect.

So, on the server hidden into a subnetwork, I have to use these:
Enable NAT traversal -- on
Global Discovery -- on
Local Discovery -- on
Enable Relaying -- off

At least they don't seem to be sending actual files over the global Internet. And I hope they can't be hacked from Internet either :) On the other hand, if my global Internet connection is lost, these two won't see each other anymore even though standing on the same desk :)

Post Reply