Forrest logo
back to the ssh tool

ssh:tldr:ce1fd

ssh: SSH tunneling: Forward a specific port (`localhost:9999` to `example.org:80`) along with disabling pseudo-[T]ty allocation and executio[N] of remote commands.
$ ssh -L ${9999}:${example-org}:${80} -N -T ${username}@${remote_host}
try on your machine

This command is using the SSH protocol to establish a secure connection between your local machine and a remote host. Let's break down the different parts of the command:

  • ssh: This is the command-line tool for using the SSH protocol.
  • -L ${9999}:${example-org}:${80}: This specifies a local port forwarding. It instructs SSH to listen on port 9999 on your local machine and forward any traffic to the remote host's port 80. ${9999} represents the local port number, ${example-org} represents the remote address or hostname, and ${80} represents the remote port number.
  • -N: This option tells SSH not to execute any remote command. It is useful when you only want to forward ports without starting a shell session on the remote host.
  • -T: This option disables pseudo-terminal allocation. It is useful when you don't need a terminal session on the remote host.
  • ${username}@${remote_host}: Here, ${username} is the username used to log in to the remote host, and ${remote_host} is the hostname or IP address of the remote host.

Overall, this command establishes a local port forwarding from port 9999 on your local machine to port 80 on the remote host, without executing any remote command or allocating a pseudo-terminal. This allows you to access services running on the remote host's port 80 as if they were running on your local machine's port 9999.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the ssh tool