Claude·2 min read

claude: command not found on a DirectAdmin server with jailshell

Why claude works for the admin but not for other users, and how to install Claude Code server-wide so it also works in DirectAdmin's jailshell.

You install Claude Code on a DirectAdmin server, it works for the admin, but a regular user gets:

[client@server ~]$ claude
bash: claude: command not found

This article is for server administrators. We ran into it ourselves on our own hosting server.

The cause: the jail can't see your installation

DirectAdmin can put users in a jailshell (jail=ON in the user settings). That jail is built on bwrap and only shows the user a small part of the system:

  • /usr (read-only)
  • their own home directory
  • a few individual files from /etc (such as resolv.conf and /etc/profile.d)

/opt, /root and other home directories don't exist inside the jail. If Claude lived in /opt/claude with a symlink in /usr/local/bin, that link points to nothing inside the jail. Hence "command not found", while ls /usr/local/bin/claude works fine as root.

The fix: install under /usr

Put the Claude binary itself under /usr, for example:

install -d -m 755 /usr/local/lib/claude/versions
install -m 755 /path/to/claude-binary /usr/local/lib/claude/versions/2.1.198
ln -sfn /usr/local/lib/claude/versions/2.1.198 /usr/local/bin/claude

Check it as the user, through the jail:

su - client -c "which claude; claude --version"

Updates: central, not per user

Users can't write to /usr, so the built-in auto-updater doesn't work there. Turn it off with a file in /etc/profile.d (which is visible inside the jail):

echo 'export DISABLE_AUTOUPDATER=1' > /etc/profile.d/claude.sh

You update as root: put the new version in versions/ and repoint the symlink.

"claude command at ~/.local/bin/claude missing or broken"

You'll see this warning the first time a user starts Claude. Claude Code expects its own copy in ~/.local/bin. It's harmless: Claude simply starts from /usr/local/bin. However, Claude often installs its own copy in the user's home directory afterwards, which comes before /usr/local/bin in the PATH and updates itself.

Keep in mind:

  • That copy is over 200 MB per user and counts towards the disk quota.
  • It ends up in backups of the home directory. Exclude .local/share/claude if you don't want that.

In short

Problem Fix
command not found in jailshell binary under /usr/local/lib, not /opt
auto-updater fails DISABLE_AUTOUPDATER=1 in /etc/profile.d
large copy per user accept it or exclude it from backups
MK
Maarten Keizer

Founder of Invoker. Over twenty years in hosting, system administration and web development; builds the Claude hosting himself and tests everything on our own servers first.

about maarten