# scp conections refused

**URL:** <https://community.unix.com/t/scp-conections-refused/328078>\
**Category:** UNIX for Dummies Questions & Answers\
**Created:** [May 7, 2013, 4:32am UTC](https://community.unix.com/t/scp-conections-refused/328078 "2013-05-07T04:32:26Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![williamen](https://community.unix.com/user_avatar/community.unix.com/williamen/32/2863_2.png) [@williamen](https://community.unix.com/u/williamen)\
**Post date:** [May 7, 2013, 4:32am UTC](https://community.unix.com/t/scp-conections-refused/328078/1 "2013-05-07T04:32:26Z")

</div>

hi guys,

I use command scp conections refuse.

I will copy file ganteng.txt to host 172.16.x.x

```nohighlight
# scp ganteng.txt -p 9060 amin@172.16.x.x:/root 
ssh: connect to host 172.16.x.x port 22: Connection refused
lost connection

```

If I : `ssh -p 9060 amin@172.16.x.x `

conected insert your password.

I use OS Aix 6.1

Need your help guys..

best regard

---

<div class="post-metadata">

**Author:** ![funksen](https://community.unix.com/letter_avatar/funksen/32/5_5575768a8748004e209b776fc1b2916d.png) [@funksen](https://community.unix.com/u/funksen)\
**Post date:** [May 7, 2013, 5:13am UTC](https://community.unix.com/t/scp-conections-refused/328078/2 "2013-05-07T05:13:44Z")

</div>

scp uses -P upper case, ssh -p lower case to specify the port

just to confuse users I guess 😉

---

<div class="post-metadata">

**Author:** ![williamen](https://community.unix.com/user_avatar/community.unix.com/williamen/32/2863_2.png) [@williamen](https://community.unix.com/u/williamen)\
**Post date:** [May 7, 2013, 6:20am UTC](https://community.unix.com/t/scp-conections-refused/328078/4 "2013-05-07T06:20:27Z")

</div>

> [@funksen](#):
>
> scp uses -P upper case, ssh -p lower case to specify the port
> 
> just to confuse users I guess 😉

funksen,

I use your command -p or -P ( not effect)

---

<div class="post-metadata">

**Author:** ![funksen](https://community.unix.com/letter_avatar/funksen/32/5_5575768a8748004e209b776fc1b2916d.png) [@funksen](https://community.unix.com/u/funksen)\
**Post date:** [May 7, 2013, 7:31am UTC](https://community.unix.com/t/scp-conections-refused/328078/5 "2013-05-07T07:31:43Z")

</div>

sshd is listening on port 9096 in your case

your error message says:

> [@](#):
>
> ssh: connect to host 172.16.x.x port 22: Connection refused

you see scp is trying to connect to port 22 because of your wrong syntax

it's not just the -p, I would also say the order of your arguments and options is wrong

try:

```plaintext
scp -P 9060 ganteng.txt amin@172.16.x.x:/root

```

---

<div class="post-metadata">

**Author:** ![williamen](https://community.unix.com/user_avatar/community.unix.com/williamen/32/2863_2.png) [@williamen](https://community.unix.com/u/williamen)\
**Post date:** [May 8, 2013, 12:36am UTC](https://community.unix.com/t/scp-conections-refused/328078/6 "2013-05-08T00:36:10Z")

</div>

> [@funksen](#):
>
> sshd is listening on port 9096 in your case
> 
> your error message says:
> 
> you see scp is trying to connect to port 22 because of your wrong syntax
> 
> it's not just the -p, I would also say the order of your arguments and options is wrong
> 
> try:

Funksen..

I try u command..  
Error this..

```plaintext
# scp -P 9060 XXX.SAR amin@172.16.x.x:/root
amin@172.16.x.x's password: 
Could not chdir to home directory /home/amin: A parameter must be a directory.
scp: /root: Permission denied

```

for your informations

---

<div class="post-metadata">

**Author:** ![Scott](https://community.unix.com/letter_avatar/scott/32/5_5575768a8748004e209b776fc1b2916d.png) [@Scott](https://community.unix.com/u/Scott)\
**Post date:** [May 8, 2013, 1:55am UTC](https://community.unix.com/t/scp-conections-refused/328078/7 "2013-05-08T01:55:03Z")

</div>

I'm not quite sure why you're hiding part of a private IP address, but... 😉

User amin does not have access to root's "home" directory, so why are you trying to copy the file there?

scp the file as the root user, or put the file somewhere amin has permission to write to.

Also, there's nothing specifically AIX-related here, so I have moved this thread from the AIX forum.

---

<div class="post-metadata">

**Author:** ![williamen](https://community.unix.com/user_avatar/community.unix.com/williamen/32/2863_2.png) [@williamen](https://community.unix.com/u/williamen)\
**Post date:** [May 8, 2013, 2:23am UTC](https://community.unix.com/t/scp-conections-refused/328078/8 "2013-05-08T02:23:25Z")

</div>

> [@scott](#):
>
> I'm not quite sure why you're hiding part of a private IP address, but... 😉
> 
> User amin does not have access to root's "home" directory, so why are you trying to copy the file there?
> 
> scp the file as the root user, or put the file somewhere amin has permission to write to.
> 
> Also, there's nothing specifically AIX-related here, so I have moved this thread from the AIX forum.

because maybe config ssh deny root login?

---

<div class="post-metadata">

**Author:** ![Scott](https://community.unix.com/letter_avatar/scott/32/5_5575768a8748004e209b776fc1b2916d.png) [@Scott](https://community.unix.com/u/Scott)\
**Post date:** [May 8, 2013, 2:26am UTC](https://community.unix.com/t/scp-conections-refused/328078/9 "2013-05-08T02:26:53Z")

</div>

Yes, possibly, but it's a directory access permission error you have, so you can't write the file there as the amin user. You either have to modify /root permission (not recommended), copy the file somewhere else, or copy the file as root.
