bug-bash
[Top][All Lists]
Advanced

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

ssh localhost date # no startup files read: ~/{.bash_profile,.bash_login


From: Name withheld by request
Subject: ssh localhost date # no startup files read: ~/{.bash_profile,.bash_login,.profile,.bashrc}
Date: Fri, 10 Jun 2005 15:41:35 +0000 (GMT)

I posted this (see below/[should bash read ~/.bashrc when "ssh localhost date" 
runs?])
to the cygwin mailing list.  Was I correct? Any comments?
To get Cygwin's attention I need to prove they have a bug first..

  related thread: http://sources.redhat.com/ml/cygwin/2005-06/msg00306.html

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
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':
  adm_tsr@localhost'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:

  [rodmant@alex rodmant]$ uname -a
  Linux alex 2.6.5-1.358 #1 Sat May 8 09:04:50 EDT 2004 i686 athlon i386 
GNU/Linux
  [rodmant@alex rodmant]$ echo $SHELL
  /bin/bash
  [rodmant@alex rodmant]$ grep rodmant /etc/passwd
  rodmant:x:502:502::/home/rodmant:/bin/bash
  [rodmant@alex rodmant]$ seq 20|sed 's~^~## ~'|tee -a 
~/{.bash_profile,.bash_login,.profile,.bashrc}
  ## 1
  ## 2
  <snip>
  ## 19
  ## 20
  [rodmant@alex rodmant]$ date
  Fri Jun 10 07:14:14 CDT 2005
  [rodmant@alex rodmant]$ date
  Fri Jun 10 07:15:40 CDT 2005
  [rodmant@alex rodmant]$ ssh localhost date
  rodmant@localhost's password:
  Fri Jun 10 07:16:11 CDT 2005
  [rodmant@alex 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
  [rodmant@alex 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 joedoe@myhost.mydomain.xxx 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.




reply via email to

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