Jump from your laptop through a bastion host so the private key never stays on the customer's machine; then use a short script to record the server's state first.

Key points at a glance

  • ssh -J is shorthand for ProxyJump: one command that goes through multiple bastion hosts as needed, with each hop separated by commas.
  • The top ten first commands for troubleshooting compiled by Brendan Gregg and the Netflix performance team in 2015 include uptime, dmesg | tail, and vmstat 1.
  • A diagnostic script should be easy to read above all, because simple scripts tend to grow more complex over time.

On-site with a customer, the first thing you type is often not code, but a

-J

command with the

ssh

flag, followed by

uptime

. Within those few minutes, the customer will judge whether you can take control of their systems.

Enterprise servers are rarely exposed directly to the public internet. You have to go through a bastion host, and you usually cannot install anything on the target machine. To excel as a Forward Deployed Engineer (FDE), two things must become second nature: getting onto the target machine cleanly, and recording the machine's state before you start guessing.

This guide walks you through building a realistic setup on your own laptop: reaching a target machine through a bastion host, running a few built-in system commands, then wrapping them into a short script that brings the results back to your local machine. You need a machine with the OpenSSH client installed, plus two Linux machines you can SSH into—VMs or cloud instances both work.

The first machine acts as the bastion host; the second acts as "the customer's server".

Step 1: Replace two logins with a single ssh -J

Beginners often SSH into the bastion host first, then SSH from there to the target machine. That works, but it easily leaves your private key on the bastion host—which is the customer's machine. According to the OpenSSH ssh(1) manual, the

-J

flag is

ProxyJump

shorthand for the directive, and it is the standard way to log in via a jump host.

ssh -J [email protected] [email protected]

With a single command, the connection to the target machine originates from your laptop and is tunneled through the bastion host. After logging in, first run

hostname

to confirm you are on

app-01

and not on the bastion host. This mistake sounds trivial, but running the wrong command on a customer's bastion host is no small matter.

Some customers have two layers of bastion hosts, for example one for the office network and one for the production zone. The manual allows declaring multiple hops, separated by commas:

ssh -J user@bastion-outer,user@bastion-inner [email protected]

Step 2: Put the route into ~/.ssh/config

Typing the full chain every time is tedious and error-prone. Since

-J

is just

ProxyJump

shorthand for the directive, you can put the route into the config file—configure it once, use it repeatedly. The example below is trimmed to the minimum number of lines:

Host client-bastion
    HostName bastion.example
    User user

Host client-app01
    HostName app-01.internal
    User user
    ProxyJump client-bastion

From then on, you only need

ssh client-app01

. After logging in, run

hostname

to check as before. Add a customer prefix to hostnames: when working on two projects at once, a name like

app01

can easily lead you into the wrong environment.

At some customers, you will see older configs that use

ProxyCommand

instead of

ProxyJump

. It relies on the

-W

flag, which the manual describes as: forwarding the client's standard input and standard output to a given host and port over a secure channel. You don't need to write it this way yourself, but you should be able to read it. A minimal example:

Host client-app01-old
    HostName app-01.internal
    ProxyCommand ssh -W app-01.internal:22 client-bastion

Step 2: The three commands to run first, and what to compare against

After logging in, people always want to open the application logs right away. Hold off. Brendan Gregg's Linux performance page links to the article "Linux Performance Analysis in 60,000 Milliseconds", which he co-wrote with the Netflix performance engineering team in 2015; it lists the ten commands to run first when troubleshooting.

The Thomas-Krenn wiki republished this list. Three of the commands are present on almost every Linux machine:

uptime
dmesg | tail
vmstat 1

Raw output means nothing without a reference point. So before going on-site, run these three commands on your own machine—once while idle, once under high load—and save both results as baselines.

On the customer's machine, the concrete task is to place the output side by side with the two baselines and mark the differences.

uptime

Are the values closer to the idle baseline or the high-load one?

dmesg | tail

Are there any lines that don't appear in the baselines?

vmstat

Which column deviates the most? These three questions are enough to tell you where to dig deeper next.

Interpreting column by column is the subject of the next lesson. To understand

vmstat

, refer to the vmstat feature article linked from the Thomas-Krenn wiki, and read Gregg's original article for the full list of ten commands.

Step 4: A diagnostic script should be readable within 10 seconds

After a few rounds, you'll want to put these commands into a file. The Shell Scripting Tutorial treats clear, readable formatting as the most important criterion. Scripts hastily written on-site often get opened by others—sometimes by the customer's ops engineer standing right next to you.

#!/bin/bash
# diagnose.sh:记录机器状态,只使用系统自带命令

echo "== Host: $(hostname)"

echo "== uptime"
uptime

echo "== dmesg | tail"
dmesg | tail

echo "== vmstat(5 次采样,每秒一次)"
vmstat 1 5

End the script with

vmstat 1 5

so it stops after five samples instead of running forever. This is a trimmed version; verify it against the

man vmstat

on the machine you actually use. Some systems may not allow ordinary users to read

dmesg

. If that happens, just note the error message—don't take it upon yourself to request root access.

Run the script without copying it onto the customer's machine (trimmed version):

cat diagnose.sh | ssh client-app01 'bash -s' > results-app01.txt

The results are saved on your laptop, ready to send to teammates or paste into a ticket. Check the

== Host:

line in the file to confirm the output came from the right host.

Common mistake: letting the script grow and grow

The Shell Scripting Tutorial warns that simple scripts tend to become complex scripts. On-site with a customer, this happens fast. Today you add a loop over ten hosts, tomorrow some output parsing, and next week it's a 300-line Bash script nobody dares to touch.

As soon as the script starts growing branches, stop and ask: is this a one-off diagnostic tool, or a product the customer will maintain later? If it's a product, discuss it with the customer before leaving it on their machine.

Two other common mistakes. One is copying your private key onto the bastion host for convenience; with

-J

there is no need at all. The other is forgetting to check

hostname

and spending half an hour diagnosing the wrong machine.

How this skill shows up on-site with customers

Imagine a customer reports: their API has been slow since this morning. You don't yet have access to their monitoring, only an SSH account that logs in through a bastion host. About a minute after logging in, you have an output file clearly labeled with the hostname, ready to compare against a healthy baseline at any time and to share with teammates.

That earns far more trust than saying "let me take a look at the code first".

To practice systematically, two resources are worth using. Linux Journey was created by Cindy Quach in 2015 and is now run by LabEx; it's free and requires no registration. Its advanced and networking sections cover logs and troubleshooting.

LabEx's Linux for Noobs course offers 37 labs on a real Linux terminal—19 guided labs and 18 self-paced challenges—covering SSH, logs, processes, and Bash scripting.

If an FDE job description mentions working in customer environments or restricted access, it usually means you'll be logging in through a bastion host like this. It's worth asking for specifics in the interview.

On your resume, rather than a vague "proficient in Linux", describe a specific incident: how you got onto the machine, what you ran first, and how long it took you to find the root cause.

What clients remember about an FDE is the first few minutes on the machine: knowing exactly which host you're on, and coming back with evidence. That leaves a stronger impression than any code you write afterward.

Was this article helpful?

Thanks for your feedback!

6 sources

Next on the roadmap · Phase 2: Full-stack engineering skills Submitting with the wrong email hurts client trust more than a bug does. From separating identities by directory to following review rules, five habits that keep your first merge request on the client's internal GitLab from getting stuck.