Larry:

Thanks for taking the time to reply, and thanks for the (~/.bash_login) 
suggestion.

Below are two tests cases for "ssh localhost date". The Linux
test shows that ~/.bashrc is read. The Cygwin case shows none of
~/{.bash_profile,.bash_login,.profile,.bashrc} are read. Doesn't this
seem like a bug?

Tests today w/linux suggest, this bash man page snippet is important:

  Bash attempts to determine when it is being run  by  the  remote  shell
  daemon,  usually  rshd.  If bash determines it is being run by rshd, it
  reads and executes commands from ~/.bashrc, if that file exists and  is
  readable.

--
The tests:

  ~ $ uname -a
  CYGWIN_NT-5.0 argon 1.5.17(0.129/4/2) 2005-05-25 19:38 i686 unknown unknown 
Cygwin
  ~ $ grep $(id -un) /etc/passwd|awk -F: '{print $NF}'
  /bin/bash
  ~ $ seq 20|sed 's~^~## ~'|tee -a 
~/{.bash_profile,.bash_login,.profile,.bashrc}|tail -5
  ## 16
  ## 17
  ## 18
  ## 19
  ## 20
  ~ $ date
  Fri Jun 10 07:34:10 CDT 2005
  ~ $ date
  Fri Jun 10 07:37:48 CDT 2005
  ~ $ ssh localhost date
  Enter passphrase for key '/home/adm_tsr/.ssh/id_rsa':
  [EMAIL PROTECTED]'s password:
  Fri Jun 10 07:38:10 CDT 2005
  ~ $ ls -lurt ~/.[bp]*[^y] /etc/profile ##
  -rwxr-xr-x  1 adm_tsr Users 5070 Jun 10 07:29 /etc/profile*
  -rw-rw-r--  1 adm_tsr Users  222 Jun 10 07:34 /home/adm_tsr/.bash_profile
  -rw-rw-r--  1 adm_tsr Users  222 Jun 10 07:34 /home/adm_tsr/.bash_login
  -rw-rw-r--  1 adm_tsr Users  222 Jun 10 07:34 /home/adm_tsr/.profile
  -rw-rw-r--  1 adm_tsr Users  111 Jun 10 07:34 /home/adm_tsr/.bashrc

Linux test, notice ~/.bashrc is read:

  [EMAIL PROTECTED] rodmant]$ uname -a
  Linux alex 2.6.5-1.358 #1 Sat May 8 09:04:50 EDT 2004 i686 athlon i386 
GNU/Linux
  [EMAIL PROTECTED] rodmant]$ echo $SHELL
  /bin/bash
  [EMAIL PROTECTED] rodmant]$ grep rodmant /etc/passwd
  rodmant:x:502:502::/home/rodmant:/bin/bash
  [EMAIL PROTECTED] rodmant]$ seq 20|sed 's~^~## ~'|tee -a 
~/{.bash_profile,.bash_login,.profile,.bashrc}
  ## 1
  ## 2
  <snip>
  ## 19
  ## 20
  [EMAIL PROTECTED] rodmant]$ date
  Fri Jun 10 07:14:14 CDT 2005
  [EMAIL PROTECTED] rodmant]$ date
  Fri Jun 10 07:15:40 CDT 2005
  [EMAIL PROTECTED] rodmant]$ ssh localhost date
  [EMAIL PROTECTED]'s password:
  Fri Jun 10 07:16:11 CDT 2005
  [EMAIL PROTECTED] rodmant]$ ls -lurt ~/.[bp]*[^y] ##
  -rw-r--r--  1 rodmant rodmant  24 Mar 12 14:22 /home/rodmant/.bash_logout
  -rw-r--r--  1 rodmant rodmant 302 Jun 10 07:12 /home/rodmant/.bash_profile
  -rw-rw-r--  1 rodmant rodmant 111 Jun 10 07:14 /home/rodmant/.profile
  -rw-rw-r--  1 rodmant rodmant 111 Jun 10 07:14 /home/rodmant/.bash_login
  -rw-r--r--  1 rodmant rodmant 235 Jun 10 07:16 /home/rodmant/.bashrc
  [EMAIL PROTECTED] rodmant]$ ls -lu /etc/profile
  -rw-r--r--  1 root root 842 Jun 10 07:12 /etc/profile

On Tue 6/7/05 19:50 EDT Larry Hall wrote:
> At 04:10 PM 6/7/2005, you wrote:
> ><I'm running 1.5.17, if appropriate pls forward to the bash maintainer>
> >
> >I want to be able to run a noninteractive command like
> >
> >  ssh [EMAIL PROTECTED] somecommand
> >
> >where user "joedoe" has /bin/rbash in /etc/passwd for a shell.  
> >
> >  How do I restrict the PATH that is seen for the above ssh session?
> >
> >I have tried changing and exporting PATH in ~joedoe/.bashrc but this
> >file is not read by prior to running "somecommand" above.
> 
> 
> This isn't a Cygwin-specific question so it's really off-topic for 
> this list.  Of course, you can always use something like ~/.bash_login.
> See the bash man page for more details and what files get executed when.
> 
> 
> --
> Larry Hall                              http://www.rfk.com
> RFK Partners, Inc.                      (508) 893-9779 - RFK Office
> 838 Washington Street                   (508) 893-9889 - FAX
> Holliston, MA 01746                     

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply via email to