Page 2 of 2

How to transfer files between pcs on same network

Posted: 03 Oct 2019, 15:53
by Ed_P
:)
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

How to transfer files between pcs on same network

Posted: 03 Oct 2019, 17:04
by Blaze

How to transfer files between pcs on same network

Posted: 03 Oct 2019, 20:55
by Ed_P
: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.

How to transfer files between pcs on same network

Posted: 03 Oct 2019, 23:45
by Shadow0815
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

How to transfer files between pcs on same network

Posted: 04 Oct 2019, 00:36
by Ed_P
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!)

How to transfer files between pcs on same network

Posted: 06 Oct 2019, 23:13
by Ed_P
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#