Skip to Content
Linux Administration Cookbook
book

Linux Administration Cookbook

by Adam K. Dean
December 2018
Beginner
826 pages
22h 54m
English
Packt Publishing
Content preview from Linux Administration Cookbook

How it works...

When you use the -L flag with SSH, you're specifying that any connection attempts made to the local machine, on the first port listed, are to be forwarded to the remote host and port.

Let's break down the command:

[vagrant@centos1 ~]$ ssh -f -L 9999:127.0.0.1:8888 192.168.33.11 sleep 120

First, the -f and sleep 120 at the end of the command are a quick way to create a session and background it while we perform our test:

-f ... sleep 120
In the real world, you're not limited to just one Terminal window, and generally, you'll find yourself opening a session to a remote host in one window while you work in another.

The second part is the interesting bit:

-L 9999:127.0.0.1:8888

Here, we're saying that local port 9999 should have ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Practical Linux Security Cookbook - Second Edition

Practical Linux Security Cookbook - Second Edition

Tajinder Kalsi
Mastering Linux Administration

Mastering Linux Administration

Alexandru Calcatinge, Julian Balog

Publisher Resources

ISBN: 9781789342529Supplemental Content