[clug] scp

Scott Ferguson scott.ferguson.clug at gmail.com
Thu Sep 7 02:45:40 UTC 2017



On 07/09/17 12:04, Bryan Kilgallin (iiNet) via linux wrote:
> Thanks, Scott:
> 
>> scott at aspire ~ $ whoami;pwd
>> scott
>> /home/scott
>> scott at aspire ~ $ date +%d%m%Y-%H%M > text.txt
>> scott at aspire ~ $ cat text.txt
>> 07092017-1102
>> scott at aspire ~ $ ping -c1 testing.sunnyside
>> PING testing.sunnyside (192.168.0.4) 56(84) bytes of data.
>> 64 bytes from testing.sunnyside (192.168.0.4): icmp_seq=1 ttl=64
>> time=0.561 ms
>>
>> --- testing.sunnyside ping statistics ---
>> 1 packets transmitted, 1 received, 0% packet loss, time 0ms
>> rtt min/avg/max/mdev = 0.561/0.561/0.561/0.000 ms
> 
> From my tower PC to the laptop, all of these tests passed.

I assume you mean you could ping $laptop from $hostname....

> 
>> scott at aspire ~ $ grep testing /etc/hosts
>> 192.168.0.4     testing.sunnyside testing
> 
> Unfortunately the hosts lists on both tower PC and laptop--did not
> contain the laptop's hostname!

Confusing - as you just wrote that you could ping it.... or where you
somehow believing you could ping the computer name (testing.sunnyside)
or IP address I used in the example?!! (you can't).

 Rather, on the laptop, hosts has the
> following line.
> 127.0.1.1    clug01
> Which latter differs from the entry in the following file.
> /etc/hostname


/etc/hostname defines the name of *that* computer (which ever computer
that file is on, not other computers).
/etc/hosts is used by *that* computer to resolve hostnames, mostly of
*other* computers (and other 'names' like localhost) into IP addresses.
/etc/hosts is only useful for static addresses.

If you use a computer "name" (e.g. ping google.com at the CLI, or try
and load google in a web browser) the first place that is checked is
/etc/hosts
If there isn't an entry for "google.com" there a nameserver is queried.
On a small LAN like your you may not be running a local nameserver so to
uses computer names at the CLI you need to add an entry in /etc/hosts

See "man hosts" (note that you likely do have a form of a local
nameserver, avahai, but I'm trying to keep this simple and brief)


Replace $laptop and $tower with the actual names.

If you wish to send a file from $tower to $laptop:-

 'Ideally' on $tower you should generate an ssh key using "ssh-keygen"
and then authenticate that key on $laptop using "ssh-copy-id" - OR
you'll have use password authentication (and enable it in the ssh policy
on $laptop if disabled by good security policy)

 'Ideally' /etc/hosts on $tower should contain an entry for $laptop *if*
$laptop has a static IP address - OR just type the IP address instead of
using the hostname

To add an entry to /etc/hosts on $tower, replace $laptop_IP with the IP
address of $laptop:-

sudo echo "$laptop_IP    clug01" >> /etc/hosts

After which you can test by checking the output of:-
ping clug01


A quick search on the internet should give you plenty of better guides
to using scp to copy a file across a local network than the above - and
a long list of alternative techniques.
"man scp" (the -v is the key to problem solving, likewise with ssh issues)


NOTES: For a GUI in a console, if you have MC installed you can do
"sHell link" (under the Left and Right tabs) F9. There is built-in help.
For a desktop GUI, if you have KDE you can just use fishIO in Dolphin
(type "fish:/$laptop" into the Browse URL). Other desktop's file
browsers have similar methods of allowing network file transfer.



Kind regards



-- 
    A: Because we read from top to bottom, left to right.
    Q: Why should I start my reply below the quoted text?

    A: Because it messes up the order in which people normally read text.
    Q: Why is top-posting such a bad thing?

    A: The lost context.
    Q: What makes top-posted replies harder to read than bottom-posted?

    A: Yes.
    Q: Should I trim down the quoted part of an email to which I'm reply

http://www.idallen.com/topposting.html



More information about the linux mailing list