bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: /bin/su - newuser -c "command" does not execute .profile


From: Paul Jarc
Subject: Re: /bin/su - newuser -c "command" does not execute .profile
Date: Wed, 30 Jan 2002 11:01:24 -0500
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/20.7 (i386-redhat-linux-gnu)

markus.sonderegger@juliusbaer.com wrote:
> root@ws0054:/# /bin/su - bcom -c "id"
> uid=120(bcom) gid=129(bcom)
>
> As one can see from the last line .profile gets not executed.

See the INVOCATION section of the man page:
       An  interactive  shell  is  one started without non-option
       arguments and without the -c option whose  standard  input
       and  output are both connected to terminals (as determined
       by isatty(3)), or one started with the -i option.
...
       When bash is invoked as an interactive login shell, or  as
       a  non-interactive shell with the --login option, it first
       reads and executes commands from the file /etc/profile, if
       that  file  exists.  After reading that file, it looks for
       ~/.bash_profile, ~/.bash_login, and  ~/.profile,  in  that
       order,  and reads and executes commands from the first one
       that exists and is readable.

Your shell is non-interactive (due to -c) and does not have --login,
so it doesn't read the *profile files.


paul



reply via email to

[Prev in Thread] Current Thread [Next in Thread]