Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to connect to certain port in ssh command

Status
Not open for further replies.

ahmad_abdulghany

Advanced Member level 4
Advanced Member level 4
Joined
Apr 12, 2005
Messages
1,206
Helped
102
Reputation
206
Reaction score
22
Trophy points
1,318
Location
San Jose, California, USA
Visit site
Activity points
11,769
Hi,
I want to connect via ssh command in Linux but to a different port than the default port (number 22). What is the option should i add ?

I tried: ssh -oPORT <port_num_in_4_digits> -l <user_name> <host_address>
But it didn't work..

Any other solution please?
Thanks in advance,
Ahmad,
 

hello

SSH provides this functionality with port forwarding.

Port forwarding allows a user to create an encrypted session from a client to a remote server for any TCP-based service by tunneling the service through SSH. Of course, this requires that the user have an account on the remote server and that the OpenSSH daemon is running on the server.

OpenSSH allows you to configure port forwarding from the command line using the –L option as shown below:

$ ssh -L local_port:remote_host:remote_port hostname

where

local_port = the port on the local host that will listen for local connections

remote_host = the remote host where the service you wish to port forward is located

remote_port = the port on which the remote host is listening for the service you wish to port forward

hostname = the host to which you are creating an SSH session to

The local port can be any port on the local machine that does not already have a listening service. If you wish to utilize a reserved port (below 1024), you must have root privileges on your local machine.

enjoy

see book "Sams - Institute Openssh A Survival Guide For Secure Shell Handling Version 1.0"
 
ghbolivar, You are great! :)

Thank you for your help..
But execuse me, as i'm beginner to remote administration, I will ask another question (i think it is answered above, but i couldn't apply :oops:)

I connect to internet via proxy with name of server: "isaserver" and port: "8080" .. this descripes my current PC.

And i want to connect to a remote server with IP alias: remote.dnsalias.net with the default port there (I think it's port number: "22")

Then how can i connect via ssh? I have root privelliage on my PC. I thought that it's impossible before you opened the door of hope to me :)

BTW, is the book you mentioned available as a soft copy?

Thanks in advance,
Ahmad,
 

How about using built-in manuals under Linux/UNIX? (o;

Code:
man ssh

Normally to connects to a specific port as a specific user you would do:

Code:
ssh -l username -p portnumber host


cheers
davorin
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top