How to fix sshd re-exec requires execution with an absolute path in SSH

SSHINTERMEDIATEMEDIUMUpdated Jan 4, 2026ยท 382 views

This error occurs when you try to start the SSH daemon without using its full absolute path. sshd enforces this security requirement to prevent PATH manipulation attacks and to ensure the re-exec mechanism works correctly.

Quick fix

Fixes sshd re-exec requires execution with an absolute path

which sshd
  1. Locate the absolute path to sshd
  2. Use the absolute path to start sshd
  3. Update systemd service file (if applicable)
  4. Use service management commands instead of direct invocation
ssh โ€” error
which sshd
sshd re-exec requires execution with an absolute path

What this error means

The sshd daemon has a built-in security check that requires it to be executed using an absolute path (starting with '/') rather than a relative path or just the binary name. This is enforced in the source code and triggered whenever sshd attempts to re-execute itself after accepting a connection. The check prevents attackers from injecting a malicious 'sshd' binary into the system by exploiting PATH vulnerabilities.

Typical symptoms

  • Running 'sshd' command without full path fails with the error message
  • SSH daemon fails to start when launched from init/systemd with relative or unqualified path
  • SSH connections drop immediately after establishing
  • Custom SSH startup scripts fail with this error
  • Daemon cannot re-execute itself after accepting new connections

Common causes

  1. Attempting to start sshd using just 'sshd' instead of '/usr/sbin/sshd' or another absolute path
  2. Init system or startup script configured with a relative or relative-like path to sshd
  3. Custom wrapper scripts launching sshd without resolving the full absolute path first
  4. Environment setup where sshd location is not properly resolved to an absolute path
  5. Attempting to launch sshd from a shell alias or function that doesn't preserve the absolute path

How to fix "sshd re-exec requires execution with an absolute path"

1Locate the absolute path to sshd

Use the which command to find the absolute path to your sshd installation:

bash
which sshd

This will typically return /usr/sbin/sshd on Linux systems. If the command returns nothing, sshd is not installed or not in your PATH.

2Use the absolute path to start sshd

Start the SSH daemon using the full absolute path:

bash
/usr/sbin/sshd -t

For testing syntax without starting the daemon, use the -t flag. To run the daemon in the foreground for debugging, use:

bash
/usr/sbin/sshd -D
3Update systemd service file (if applicable)

If you have a custom systemd service file, ensure the ExecStart directive uses the absolute path:

ini
[Service]
ExecStart=/usr/sbin/sshd -D

Do not use relative paths or variables that might not expand to absolute paths. After updating, reload and restart the service:

bash
sudo systemctl daemon-reload
sudo systemctl restart ssh
4Use service management commands instead of direct invocation

Instead of trying to start sshd manually, use your system's service manager:

On systemd systems (most modern Linux distributions):

bash
sudo systemctl start ssh
sudo systemctl start sshd

On init.d systems:

bash
sudo service ssh start

On Termux (Android):

bash
cd $PREFIX/var/service
sv-enable sshd

Service managers handle the absolute path requirements automatically and are the preferred method.

5Verify sshd is running correctly

After starting sshd with the absolute path, verify it's listening on the SSH port:

bash
sudo ss -tlnp | grep sshd

Or on older systems:

bash
sudo netstat -tlnp | grep sshd

You should see sshd listening on port 22 (or your configured port). You can also test SSH connectivity:

bash
ssh -v localhost

Advanced notes

The absolute path requirement is a security feature that protects against PATH poisoning attacks. When sshd re-executes itself (which happens after accepting a connection for privilege separation), it needs to know the exact path to invoke. If sshd were allowed to start with a relative path like 'sshd' or './sshd', an attacker could place a malicious binary in a directory early in the PATH and have sshd invoke that instead. By requiring an absolute path, sshd ensures it will always re-exec the correct binary.

On some systems with containerization (like Termux), special service managers may be required. Always check your system's service manager documentation for the recommended way to start sshd. For most Linux distributions using systemd, simply use 'sudo systemctl start ssh' or 'sudo systemctl start sshd' depending on your distribution's naming convention.

Frequently asked questions

What does "sshd re-exec requires execution with an absolute path" mean?
The sshd daemon has a built-in security check that requires it to be executed using an absolute path (starting with '/') rather than a relative path or just the binary name. This is enforced in the source code and triggered whenever sshd attempts to re-execute itself after accepting a connection. The check prevents attackers from injecting a malicious 'sshd' binary into the system by exploiting PATH vulnerabilities.
How do I fix "sshd re-exec requires execution with an absolute path"?
This error occurs when you try to start the SSH daemon without using its full absolute path. sshd enforces this security requirement to prevent PATH manipulation attacks and to ensure the re-exec mechanism works correctly.
What causes "sshd re-exec requires execution with an absolute path"?
Attempting to start sshd using just 'sshd' instead of '/usr/sbin/sshd' or another absolute path Init system or startup script configured with a relative or relative-like path to sshd Custom wrapper scripts launching sshd without resolving the full absolute path first
Is the "sshd re-exec requires execution with an absolute path" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading