posted on 2015-04-21 10:24:10
In general, this will do:
The important part is the double slash after the domain, in case you specify absolute paths.
To not having to fiddle with passwords, create a
.netrc file in your home folder containing entries like this one:
machine yourftp.somewhere.org login yourlogin password "yoursecret"
Some more tricks can be found here, where this is initially from.
If vim tells something about 'buftype' and that it cannot save, issue this command prior to saving from within vim:
posted on 2013-11-16 17:05:03
scp is handy when transferring files from one host to another while being in a shell. How else to transfer stuff without using FTP or a kind of version control? Of course there are other alternatives, but
scp's advantage is that it is widely available, does not need any kind of setup on the other host (As long as you have access to your other box, that is.) and has encrypted traffic. Also no GUI, mounting of USB sticks etc. pp. is needed. Sounds great.
The syntax looks like this, higlevel:
scp SOURCE DESTINATION
Or lower level and a little more concrete:
scp <src-user>@<src-host>:/dir/file <dst-user>@<dst-host>:/dir/file
src is shorthand for 'source', dst for 'destination', in case you wondered. Of course there are flags and parameter settings that can be used. But using
man scp yourself is not rocket science. :o)
To specify working
scp calls it is helpful to properly understand the
user@host:file syntax. If your current use case is to copy a file from the host you are currently on,
user@src-host can be omitted. Just the filename (and its path if you are not in the same directory on the shell) is needed.
user is the username of the system user on the machine in question. This is the user with which you'd log into the remote machine. If passwords are needed, the system will promt you to enter them.
If you have setup SSH keys properly, and are in the same folder as the file you want to transfer, a call could look like this:
scp example.txt <dst-host>:
<dst-host> is either a valid IP or a domain name pointing to the IP.
Here are several things omitted:
<src-user>, the user on the machine you are currently logged on, and
<src-host>, the address of the current host you are on.
So the file will be put in the homefolder of the user that is used on the remote machine. (This is the folder entry of the user entry, to look it up use
grep <username> /etc/passwd on the remote machine, in case it is not
The colon in the example above MUST NOT be omitted.
Else nothing will be copied to the remote address. You will not an error message, since linux thinks the destination address you specified is a file name, and the file is copied locally.
If you want to specify a certain folder on the remote host, either use the full path, or specify it in relation to the users home directory.
## file on server will be '/home/sjas/.ssh/asdf.txt' scp file.txt 123.123.123:.ssh/asdf.txt ## file on server will be '/tmp/file.txt' scp file.txt sjas.de:/tmp
So long. Maybe as a last note that there is the
-r flag, so you can copy whole directories and not just files.
View posts from 2017-09, 2017-08, 2017-07, 2017-05, 2017-04, 2017-03, 2017-02, 2017-01, 2016-12, 2016-11, 2016-10, 2016-09, 2016-08, 2016-07, 2016-06, 2016-05, 2016-04, 2016-03, 2016-02, 2016-01, 2015-12, 2015-11, 2015-10, 2015-09, 2015-08, 2015-07, 2015-06, 2015-05, 2015-04, 2015-03, 2015-02, 2015-01, 2014-12, 2014-11, 2014-10, 2014-09, 2014-08, 2014-07, 2014-06, 2014-05, 2014-04, 2014-03, 2014-01, 2013-12, 2013-11, 2013-10