- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- scp file with a specific port
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2008 01:28 AM
тАО09-22-2008 01:28 AM
scp file with a specific port
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2008 01:41 AM
тАО09-22-2008 01:41 AM
Re: scp file with a specific port
you can use scp -P
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2008 01:57 AM
тАО09-22-2008 01:57 AM
Re: scp file with a specific port
-P port
Specifies the port to connect to on the remote host. Note that
this option is written with a capital `P', because -p is already
reserved for preserving the times and modes of the file in
rcp(1).
Th ereceiver should receive on specified port no
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2008 01:59 AM
тАО09-22-2008 01:59 AM
Re: scp file with a specific port
scp -p (permissions) -P
example
scp -p file.mine -P 22040 hostname:/destination
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2008 02:19 AM
тАО09-22-2008 02:19 AM
Re: scp file with a specific port
See this scp -P port Specifies the port to connect to on the remote host. Note that this option is written with a capital `P', because -p is already reserved for preserving the times and modes of the file inrcp(1).
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2008 02:32 AM
тАО09-22-2008 02:32 AM
Re: scp file with a specific port
when use scp -p file.mine -P 22040 hostname:/destination
it pop
-P: No such file or directory
22040: No such file or directory
what is wrong ? thx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2008 02:58 AM
тАО09-22-2008 02:58 AM
Re: scp file with a specific port
$ scp
usage: 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
$ ssh -V
OpenSSH_4.7p1, OpenSSL 0.9.8g 19 Oct 2007
Enjoy, have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2008 03:37 AM
тАО09-22-2008 03:37 AM
Re: scp file with a specific port
#ssh -v
update the ssh pkg to get -P option .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2008 03:37 AM
тАО09-22-2008 03:37 AM
Re: scp file with a specific port
Try like this
scp file.mine -P 22040 hostname:/destination
suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2008 04:04 AM
тАО09-22-2008 04:04 AM
Re: scp file with a specific port
i.e. the correct order of parameters is:
scp -P 22040 file.mine hostname:/destination
Or if you want to use the -p option to preserve the file times and permissions:
scp -p -P 22040 file.mine hostname:/destination
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2008 06:58 AM
тАО09-22-2008 06:58 AM
Re: scp file with a specific port
But one reason why you asked might be that you would like SSH forward you a remote sshd's standard port to some local unused port because both hosts aren't allowed to communicate directly due to some firewall?
If you have an interim hop host that is allowed to ssh to the remote host, and if you have someone as an account thereon then you could scp via this hop through a tunnel.
Assuming port 2222 isn't in use on localhost you could build the tunnel like this
(note that the sleep has the advantage that you don't need to kill the tunnel when you're done (often forgotten) because it will shut down after 10 minutes).
$ ssh -NL2222:not_directly_reachable_host:22 someone@hop_host sleep 600
Once the tunnel is errected
(check by "netstat -anfinet|grep 2222.*LISTEN)
you can use the locally forwarded port 2222 and copy seemingly from localhost (remember that you need to supply the password of someone on remote host; also note that picking /dev/null as your local user's known_hosts file will prevent you from wrong host keys being saved for localhost)
$ scp -P 2222 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no someone@localhost:/some/file/you/want/to.get /some/local/target
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2008 11:32 PM
тАО09-22-2008 11:32 PM
Re: scp file with a specific port
Of course, as you will have noticed, instead of
"$ ssh -NL..." it has to be "$ ssh -fL..."
-N would contradict the sleep command.