79527393

Date: 2025-03-22 11:55:58
Score: 0.5
Natty:
Report link

Note: the setting.json file I was editing was given by the command >Preferences: Open User Settings (JSON)

In the file you can find the following code

"terminal.integrated.profiles.linux": {
        "bash": {
            "path": "bash",
            "icon": "terminal-bash"
        },
        "zsh": {
            "path": "zsh"
        },
        "fish": {
            "path": "fish"
        },
        "tmux": {
            "path": "tmux",
            "icon": "terminal-tmux"
        },
        "pwsh": {
            "path": "pwsh",
            "icon": "terminal-powershell"
        }
    }

I added a new profile:

"bash (2)": {
            "path": "/bin/bash",
            "icon": "terminal-bash",
            "args": ["--login"]
        }

When connecting to the remote machine, the default profile can be selected

In the Terminal window on VSCode there's a button that show the shell type (bash in this case) and a small "plus" symbol with a down arrow. If you click on the down arrow, a menu with different informations appears. Click on "Select Default Profile"

Then, a drop-down menu will appear on the top bar showing all the possible profiles

If you clicked on "Select Default Profile", from the top bar a drop-down menu appears, listing all possible shells. In this case, the first one is "bash", the second one is "bash (2)" (the one we created). Select the profile you prefer

As expected, the "bash (2)" profile appears with the correct argument.
When launching again the shell, hovering over its icon should display the launch command

In the terminal window, if you place your mouse over the shell type icon (bash in this case), a small window appears displaying different information about the shell. The command line used to launch the shell is, in this case, /bin/bash --login, which reflects what we specified in our custom bash profile

which is what we wanted.

Unfortunately, this didn't solve my problem: the .bashrc file wasn't run since the new shell was launched as 'root' user, not as 'ubuntu' user (for which I defined the bashrc file)

To solve this, I simply run >Dev Containers: Open Container Configuration File and edited as follows

{
    "remoteUser": "ubuntu",
    "workspaceFolder": "/home/ubuntu",
    "settings": {
        "terminal.integrated.shellIntegration.enabled": false
    }
}

This solved my problem.

Reasons:
  • Probably link only (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Jacopo