Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-Id: <200506101305.j5AD5DSq021970@tigris.pounder.sol.net> From: cygwin AT trodman DOT com (Tom Rodman) To: Cygwin List Subject: ssh localhost date # no startup files read: ~/{.bash_profile,.bash_login,.profile,.bashrc} In-reply-to: <6.2.1.2.0.20050607192758.07159500@pop.prospeed.net> References: <200506072010 DOT j57KAKea003183 AT tigris DOT pounder DOT sol DOT net> <6 DOT 2 DOT 1 DOT 2 DOT 0 DOT 20050607192758 DOT 07159500 AT pop DOT prospeed DOT net> Date: Fri, 10 Jun 2005 08:05:13 -0500 X-IsSubscribed: yes 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': adm_tsr AT 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 AT 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 AT alex rodmant]$ echo $SHELL /bin/bash [rodmant AT alex rodmant]$ grep rodmant /etc/passwd rodmant:x:502:502::/home/rodmant:/bin/bash [rodmant AT alex rodmant]$ seq 20|sed 's~^~## ~'|tee -a ~/{.bash_profile,.bash_login,.profile,.bashrc} ## 1 ## 2 ## 19 ## 20 [rodmant AT alex rodmant]$ date Fri Jun 10 07:14:14 CDT 2005 [rodmant AT alex rodmant]$ date Fri Jun 10 07:15:40 CDT 2005 [rodmant AT alex rodmant]$ ssh localhost date rodmant AT localhost's password: Fri Jun 10 07:16:11 CDT 2005 [rodmant AT 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 AT 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 want to be able to run a noninteractive command like > > > > ssh joedoe AT myhost DOT mydomain DOT 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. > > > -- > 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/