I'm specifying the port when I use scp, but I get an error saying port 22 connection refused. What am I doing wrong?
All I want to do is move a file from my laptop to my server. Both machines have openssh-server installed, and port 2222 is specified in both sshd_config files as well as both ssh_config files. I'm using the following to attempt to copy the file:
scp -P 2222 user1@thenameofmylaptop:file.name user2@[serverIPaddress]:/home/user2/filepath/file.nameEven though I have password authentication set to no and rsa keys installed in both directions, it still asks me for a password. After I give it the password, it gives me the following error:
ssh: connect to host [IP address of server] port 22: Conection refused
Is there a separate config file for scp? What am I missing?
31 Answer
You don't need the user@host:/path/to/file.name syntax for the local file that you are trying to copy - in fact, doing so is likely causing scp to try to open a connection on port 2222 from your laptop to itself. Try just
scp -P 2222 path/to/file.name user2@[serverIPaddress]:/home/user2/filepath/file.name More in general
"Zoraya ter Beek, age 29, just died by assisted suicide in the Netherlands. She was physically healthy, but psychologically depressed. It's an abomination that an entire society would actively facilitate, even encourage, someone ending their own life because they had no hope. Th…"