how to disable .bashrc execution - Unix

This is a discussion on how to disable .bashrc execution - Unix ; I wrote a script which ask the password while opening a terminal. That is executed successfully. But the problem is from some other user if I put scp means the cursor is waiting and the file is not copied to ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: how to disable .bashrc execution

  1. how to disable .bashrc execution

    I wrote a script which ask the password while opening a terminal. That
    is executed successfully. But the problem is from some other user if I
    put scp means the cursor is waiting and the file is not copied to my
    directory?

    Now I want to disable execution of .bashrc during the connand scp.
    How can I do that?

  2. Re: how to disable .bashrc execution

    On Tue, 5 Feb 2008 22:17:57 -0800 (PST), lak wrote:
    > I wrote a script which ask the password while opening a terminal. That
    > is executed successfully. But the problem is from some other user if I
    > put scp means the cursor is waiting and the file is not copied to my
    > directory?
    >
    > Now I want to disable execution of .bashrc during the connand scp.
    > How can I do that?


    You can't. That's a known misfeature of bash. It reads .bashrc
    when called by ssh. And scp/ssh calls the user's login shell.

    Tell your user to use a better shell like zsh or to add a line
    like "[[ $- != *i* ] && return" at the beginning of his .bashrc

    The purpose of that misfeature was to allow the user to use
    rsh/ssh as if he was logged in (that is with the same aliases,
    functions... defined).

    --
    Stephane

  3. Re: how to disable .bashrc execution

    lak wrote:
    > I wrote a script which ask the password while opening a terminal. That
    > is executed successfully. But the problem is from some other user if I
    > put scp means the cursor is waiting and the file is not copied to my
    > directory?
    >
    > Now I want to disable execution of .bashrc during the connand scp.
    > How can I do that?


    # If not running interactively, don't do anything
    [ -z "$PS1" ] && return

    Is it perhaps something like that which you're looking for? For your info,
    not doing so and e.g. adding output or things like that can break any
    automated tool that relies on the shell's IO. I experienced this problem
    with rsync when I just wrote the content of two environment vars, for
    example.

    Uli


+ Reply to Thread