[BUG] Bash login shell

Status Fixed / completed
Maintainer reply ✓ Yes — wolffiex
Activity 9 comments · opened Dec 5, 2025 · closed Apr 18, 2026
💡 Likely answer: A maintainer (wolffiex, collaborator) responded on this thread — see the highlighted reply below.

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

$ cat ~/.claude/settings.json
{
  "alwaysThinkingEnabled": false,
  "env": {
    "CLAUDE_BASH_NO_LOGIN": "true"
  },
  "permissions": {
    "terminal": {
      "alwaysAllow": true
    },
    "fileEditing": {
      "alwaysAllow": true
    }
  }
}

but while executing some commands I see login shell prompts like:

● Bash(find /mnt/d/tomak/IdeaProjects/eurowag/azure/CMS/cms -name "CLAUDE.md" -o -name "claude.md" 2>/dev/null | head -5)
  ⎿  SSH:
     Agent pid 2329
     Identity added: /home/tomak/.ssh/id_rsa (Tomáš Doležal (https://aeiplatform.com) <tomak1@seznam.cz>)
     Identity added: /home/tomak/.ssh/eurowag_azure_rsa (Tomáš Doležal (https://www.eurowag.com) <ext-doleztom@eurowag.com>)
     MFA token for profile eurowag:
     (9s)

What Should Happen?

Should not be executing any bash comamnds as login

Error Messages/Logs

Steps to Reproduce

  1. claude
  2. /init

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.59

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

WSL (Windows Subsystem for Linux)

Additional Information

_No response_

View original on GitHub ↗

9 Comments

aeiplatform · 8 months ago

.bash_profile

# '~/.bash_profile': executed by the 'bash(1)' for login shells.
# See '/usr/share/doc/bash/examples/startup-files' in the 'bash-doc' package.
# See 'bash(1)' for more options and examples.

# Loads the non-login shell configuration file.
if [ -f ~/.bashrc ]; then
  # shellcheck disable=SC1090
  . ~/.bashrc
  export BASH_ENV=~/.bashrc
fi

# Loads the alternative login shell configuration file.
if [ -f ~/.bash_login ]; then
  # shellcheck disable=SC1090
  . ~/.bash_login
fi
aeiplatform · 8 months ago

.bash_login

# '~/.bash_login': executed by the 'bash(1)' for login shells.
# See '/usr/share/doc/bash/examples/startup-files' in the 'bash-doc' package.
# See 'bash(1)' for more options and examples.

kinit 2> /dev/null
printf "SSH: "
eval "$(ssh-agent -s)"
ssh-add

dir=$(pwd)
while [ "$dir" != / ] && [ "$dir" != ~ ] &&
  [ "$dir" != "/mnt/c/Users/tomak" ]
do
  if [ -f "$dir/.bash_login" ]; then
    sh "$dir/.bash_login"
    break;
  fi
  dir=$(dirname "$dir")
done

if command -v snap > /dev/null 2>&1; then
  if ! command -v aria2c > /dev/null 2>&1; then
    snap install aria2c --classic
  fi
  if ! command -v aws > /dev/null 2>&1; then
    snap install aws-cli --classic
  fi
fi

if command -v brew > /dev/null 2>&1; then
  if ! command -v k9s > /dev/null 2>&1; then
    brew install k9s
  fi
  if ! command -v kubectl > /dev/null 2>&1; then
    brew install kubectl
  fi
  if ! command -v kubetui > /dev/null 2>&1; then
    brew install kubetui
  fi
  if ! command -v liquibase > /dev/null 2>&1; then
    brew install liquibase
  fi
fi

if command -v pip > /dev/null 2>&1; then
  if ! command -v awslocal > /dev/null 2>&1; then
    pip install awscli-local --break-system-packages
  fi
  if ! command -v awslogin > /dev/null 2>&1; then
    pip install aws-mfa-tools --break-system-packages
  fi
fi

if [ -d "/mnt/c/Users/tomak" ]; then
  docker context use default > /dev/null 2>&1
fi

neofetch
(update) > /dev/null 2>&1 &

welcome "Tomáš Doležal" | lolcat
now
up
weather
github-actions[bot] · 8 months ago

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/11867
  2. https://github.com/anthropics/claude-code/issues/11930

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

wolffiex collaborator · 8 months ago

Thanks for this report!

aeiplatform · 8 months ago

Seems like adding:

if [ "$CLAUDE_BASH_NO_LOGIN" = "true" ]; then
  return
fi

on top the login file, is fine workearound

github-actions[bot] · 7 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

wasowski · 6 months ago

The issue is still occurring (I just reported #23079, which I will close in a moment). My issue describes a bit in which use cases this will break on users machines, but the mechanism is the same. One should not call --login shells for non-interactive command invocations. The workaround above works (I use a similar one), but the bug is on claude-code side.

ashwin-ant collaborator · 4 months ago

This was fixed in v2.0.77 — The Bash tool no longer spawns a login shell by default, and CLAUDE_BASH_NO_LOGIN is now respected when set via the settings.json env block. If you're still seeing this in the latest version, please comment with your version and repro and we'll reopen.

github-actions[bot] · 4 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.