I took a look around at other questions here and at various "scp usage" tutorials on Internet, but I can't sort out what's wrong.
I'm using Linux Mint and I'm trying to figure out how scp works.
I've a file file.ext (on my computer) in directory /home/name/dir/
I connect to a remote machine using ssh, like:
ssh -p 2222 username@domain it asks me the password and the shell displays:
username@domain ~ $ now, If I issue the command (before I ran ssh I was in the local directory /home/name/dir ):
scp -r -P 2222 file.ext username@domain output is:
cp: cannot stat ‘file.ext’: No such file or directory Same result if instead of file.ext I write the complete path
scp -r -P 2222 /home/name/dir/file.ext username@domain Also, the server admin told me that I shall upload the file to my remote home directory (instead of root), like:
scp -r -P 2222 file.ext username@domain:~/ but when I do it and press "Enter" nothing happens, as If the shell was waiting for further input.
Summary of my problems:
- cp: no such file or directory
- shell "stuck" on ~/
Any suggestions?
localuser@machineA: ssh -p 2222 username@domain(to indicate that you are running the ssh command as localuser on machineA)scp, the remote side always has to contain the colon (e.g.remotehost:/tmp), else it will just do an ordinary copy (scp /tmp/foo.txt example.comwill copy/tmp/foo.txtinto a local fileexample.com)-rflag, as this is not needed for copying single files (it's used to recursively copy directories)