0

I know others have had this issue, but I can’t extrapolate a solution to my situation. I am trying to scp a .tar.gz file onto my newly configured Ubuntu server (I’m new to server config), but I’m being refused from port 22 even though I’ve set my port in /etc/ssh/sshd_config to 25000. Here is my log on scp -v nickeleres.tar.gz [email protected]:~

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to nickeleres.com [127.0.1.1] port 22.
debug1: connect to address 127.0.1.1 port 22: Connection refused
ssh: connect to host nickeleres.com port 22: Connection refused
lost connection

UPDATE new error logs after enforcing port 25000

Executing: program /usr/bin/ssh host nickeleres.com, user root, command scp -v -t ~
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to nickeleres.com [184.168.221.35] port 25000.
debug1: connect to address 184.168.221.35 port 25000: Connection refused
ssh: connect to host nickeleres.com port 25000: Connection refused
lost connection
2
  • Did you run sudo service ssh restart after changing the port?
    – heemayl
    Feb 28, 2015 at 5:59
  • yes I did. is there another port other than the one I changed in /sshd_config that needs to be updated from 22 ?
    – redress
    Feb 28, 2015 at 19:50

1 Answer 1

4

You need to insert the new ssh port number (25000) of the destination scp should connect to, otherwise it will try to connect to the default ssh port (22). Change your command to following:

scp -v -P 25000 nickeleres.tar.gz [email protected]:~

Also note that you are writing to the root's home directory, make sure you have the right permissions. Another thing to note is the last ~ is not needed because if you don't mention the destination location scp will copy into home directory (~) of the remote user. So the following will do:

scp -v -P 25000 nickeleres.tar.gz [email protected]:

EDIT:

As 'ThomasW.' has pointed out, you can alternatively use the following:

scp -v -oPORT=25000 nickeleres.tar.gz [email protected]:~
3
  • Alternatively, scp -v -oPORT=25000 nickeleres.tar.gz [email protected]:~ - I ran into -P not working in the past, and replaced it with -oPORT=PORTNUM which seems to enforce the port number.
    – Thomas Ward
    Feb 28, 2015 at 20:32
  • please see the updated error log in my original post after running each variation of the command
    – redress
    Feb 28, 2015 at 21:23
  • @redress: Previously nickeleres.com was resolving to 127.0.0.1, now 184.168.221.35. Please make sure you are connecting to the right host, use IP address if you are not sure.
    – heemayl
    Feb 28, 2015 at 21:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .