I have a server where the default shell is tcsh. It has been setup in its .cshrc to load a number of modules on login. So it is quite slow to login and I just have to live with it.

My problem is that these modules are loaded even for an scp connection. Hence becomes frustrating if I have to wait almost a minute for every scp transfer.

I was wondering if there was a way to either disable calling .cshrc during scp transfers or make scp use a different login shell?

Thanks, Vivek

  • 4
    You can establish and reuse ssh connections, this works also for scp. See stackoverflow.com/questions/20410252/… or puppet.com/blog/speed-up-ssh-by-reusing-connections – pLumo Sep 25 '18 at 14:35
  • 1
    You can check for the SSH_CONNECTION environment variable in your .cshrc. – mosvy Sep 25 '18 at 14:53
  • 2
    Or you can check in .cshrc for the variable loginsh. This is set only for interactive shells in tcsh. For csh you would check for the variable prompt. – doneal24 Sep 25 '18 at 15:09
  • 1
    If it's only for scp multiple times, you can use sftp. – ctac_ Sep 25 '18 at 16:28
  • @mosvy, the SSH_CONNECTION was a good workaround. Thanks! I will see if there are better alternatives suggested, but you should add this as an "answer". – Vivek V K Sep 28 '18 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.