Scp in terminal to copy something from my laptop to a server

  • #1
624
11
Hi I need to copy something from my laptop to a server. I tried using scp filename servername but it didn't work. I asked someone and he said I have to use -P but I don't know how. I tried several ways but all of them give
port 22: Connection refused. What can I do?
Thank you!
 

Answers and Replies

  • #2
447
94
check to see if you can ssh into the device first.
$ ssh [email protected]

are you able to successfully ssh into the device?
 
  • #3
624
11
check to see if you can ssh into the device first.
$ ssh [email protected]

are you able to successfully ssh into the device?

NEW

Yes, I am able to connect, but I need to use ssh -p 4410 [email protected] I tried using -P and 4410 in scp command but it still didn't work.
 
  • #4
447
94
Try the following
$ scp -vP 4410 [email protected]:/path/to/file .

I added the verbose option, hopefully we see where it's going wrong
 
  • #5
624
11
Try the following
$ scp -vP 4410 [email protected]:/path/to/file .

I added the verbose option, hopefully we see where it's going wrong
Wait, so in this, where I specify the file I want to send, before or after -vP 4410? (I want to send the file from my computer to [email protected])
 
  • #8
447
94
can you show me the command you are typing in?
 
  • #9
624
11
can you show me the command you are typing in?

scp -vP 89418.txt [email protected] (username and ip-adr are the same i use for the ssh command which is working)
 
  • #12
447
94
yes, you didn't have it in your post.
 
  • #13
624
11
yes, you didn't have it in your post.
Sorry I am a bit confused. What do you mean
 
  • #14
447
94
scp -vP 89418.txt [email protected] (username and ip-adr are the same i use for the ssh command which is working)
The command you are using does not specify a destination port number. As a result, scp is using the default ssh port 22.

Your command:
scp -vP 89418.txt [email protected]

Correct command
scp -vP 4410 89418.txt [email protected]:/path/to/destination/folder/
 
  • #15
624
11
The command you are using does not specify a destination port number. As a result, scp is using the default ssh port 22.

Your command:
scp -vP 89418.txt [email protected]

Correct command
scp -vP 4410 89418.txt [email protected]:/path/to/destination/folder/
Oh, sorry I have that I just didn't add show it here. I have the /path/to/destination/folder/ part
 
  • #16
447
94
That is the correct format and should work. What is the debug output from the command?
 

Related Threads on Scp in terminal to copy something from my laptop to a server

  • Last Post
Replies
6
Views
1K
  • Last Post
Replies
9
Views
2K
  • Last Post
3
Replies
73
Views
2K
  • Last Post
Replies
1
Views
8K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
3
Views
2K
Replies
53
Views
7K
Replies
4
Views
2K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
1
Views
4K
Top