RE: Skipping statemnts in .bashrc

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

 



SFTP will not work if your session startup shell script writes anything
to stdout for non-interactive sessions. In your case, tcsh will be
executed regardless of the session type (interactive or not). So you
need to prevent execution of tcsh for non-interactive sessions. Because
SFTP starts a shell session in non-interactive mode (before starting
sftp-server) and SSH starts session in the interactive mode (unless you
give the command to be executed as an argument to the ssh client) you
could add another condition to your 'if' operator testing the type of
session. For example, in bash  in interactive mode PS1 is set and $-
includes i, allowing you to test this. 

Alexey Fadyushin.
Brainbench MVP for Linux
http://www.brainbech.com

> -----Original Message-----
> From: redhat-list-bounces@xxxxxxxxxx [mailto:redhat-list-
> bounces@xxxxxxxxxx] On Behalf Of Padiyath Sreekumaran
> Sent: Wednesday, February 22, 2006 5:11 PM
> To: redhat-list@xxxxxxxxxx
> Subject: Skipping statemnts in .bashrc
> 
> 
>   Hello,
>    Iam running RedHat 3 on my machine. I have the following .bashrc
> file.
>    (I use bash shell)
> 
>    if [ -f /etc/bashrc ]; then
>         . /etc/bashrc
> fi
> 
> #
> if [ $HOSTNAME == "pcxxxx" ]  <-----
> then
>     exec tcsh -m  <----------
> fi  <---------
> 
>      The above marked statements are executed when I log with ssh on
the
> machine
>      (pcxxxx). But these statements gives problems when I login with
> winSCP SW
>      (sftp) from windows for file transfer. I always get time out
> problems because of these
>      statements. I tried by removing the above statements
>      and sftp works. I would like to know how I can execute an exit
> command just
>      before these statements when I do sftp connection? Is there any
> environment
>      variable (INTERACTIVE?) which I can check during logging? I use
ssh
> to login to
>      pcxxxx machine.
> 
>      Thanks in advance,
>       Kumar
> 
> 
> ------------------------------------------------------------------
> Padiyath Sreekumar       |   Tel: +41.56.310.3643
> Paul Scherrer Institut   |   email: kumar.padiyath@xxxxxx
> AIT                      |   Office: WHGA/U132
> WHGA/U132                |   Fax: +41.56.310.3649
> CH-5232 Villigen PSI     |
> Switzerland              |
> -----------------------------------------------------------------
> 
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux