Home > Blockchain >  zsh command with bad local forwarding
zsh command with bad local forwarding

Time:10-28

I am trying to make a terminal command to automate connecting to a cluster and have included the following in my .zsh file

function access_cluster(){

ssh -N -f -L localhost:$2:localhost:$1 [cluster name] }

When I run access_cluster 7777 9999 from the terminal, however, I receive the following message:

Bad local forwarding specification 'localhost:9999ocalhost:7777

zsh seems to be ignoring the :l in my command, how can I fix this? I am running macOS Big Sur 11.3.1

CodePudding user response:

The port forwarding format is wrong. It should be like:

ssh -L local_port:destination_server_ip:remote_port

So in your case it should be as:

ssh -L $2:localhost:$1  cluster_name
  • Related