LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-29-2012, 03:20 AM   #1
ramecare
Member
 
Registered: Feb 2011
Posts: 179

Rep: Reputation: 0
scp command


Dear all,

In my server i have changed my default ssh port number to 1321 and while iam trying to copy a file from server to my local by using the below command and iam receving the below error,can any one help me on this

[root@itsupport 28032012]# scp ramkannan@65.15.40.155:/home/ramkannan/access_log28032012 /opt/backup
ssh: connect to host 65.15.40.155 port 22: Connection refused

Can anyone help me how to use scp command using the ssh port 1321

Thanks,

Last edited by ramecare; 03-29-2012 at 03:24 AM.
 
Old 03-29-2012, 03:26 AM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
From 'man scp':
Code:
-P port
             Specifies the port to connect to on the remote host.
So your command would be:
Code:
scp -P 1321 ramkannan@65.15.40.155:/home/ramkannan/access_log28032012 /opt/backup
 
Old 03-29-2012, 03:26 AM   #3
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 193Reputation: 193
The answer is right there in front of you...
You changed the server port to 1321.
scp is (by default) trying to connect on port 22 as indicated by:
Code:
ssh: connect to host 66.135.40.74 port 22: Connection refused
You need to add "-P 1321" to your scp command.
 
Old 03-29-2012, 03:26 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
please try reading the manpage before asking.

Code:
SYNOPSIS
     scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
         [-l limit] [-o ssh_option] [-P port] [-S program]
         [[user@]host1:]file1 [...] [[user@]host2:]file2
I'd say that laziness isn't appreciated, but you've already got 3 answers, so maybe it is...
 
Old 03-29-2012, 03:30 AM   #5
polinux
Member
 
Registered: Jun 2011
Location: Reading UK
Distribution: OpenSUSE, CenOS
Posts: 46

Rep: Reputation: 3
nice I was replaying with the answer and look there is 3 already
 
Old 03-29-2012, 03:47 AM   #6
ramecare
Member
 
Registered: Feb 2011
Posts: 179

Original Poster
Rep: Reputation: 0
Thank u to all
 
Old 03-30-2012, 10:33 AM   #7
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
It would be even more convenient to define it in ~/.ssh/config, as it will be honored by ssh and scp:
Code:
Host any_nickname_you_like
    Port 1321
    Hostname 66.135.40.74
    User ramkannan
Then it should work to issue:
Code:
$ scp any_nickname_you_like:access_log28032012 /opt/backup
$ ssh any_nickname_you_like
and avoid to specify all the options all the time.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
scp command zchoyt Linux - General 10 04-02-2014 07:47 AM
scp command Swapna173 Linux - Newbie 5 05-21-2009 01:54 AM
Translating windows pscp command to linux scp command help robward Linux - General 2 01-17-2008 06:02 AM
SCP Command yusufs Linux - Newbie 3 11-07-2007 02:44 PM
command of scp Paxmaster Linux - General 4 01-06-2005 12:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration