Skip to content
Advertisement

.bashrc file preventing some SFTP GUI APP from logging to the VM

I have a .bashrc file running on my Ubuntu server

JavaScript

I can log-in to my VM perfectly fine via SSH.

I am not sure why in some SFTP client (GUI Apps) like Cyberduck preventing me from log-in into my VM. But when remove my .bashrc or deactivating it, it works fine.


Questions

Is there a main reason behind this ?

What exactly is in my .bashrc that I shouldn’t do ?

Advertisement

Answer

Your bashrc file probably outputs stuff to stdout, which some SFTP programs might try to interpret as SFTP commands, leading to connection or authentication failure.

You should make sure your bashrc file only works for interactive sessions using one of those two techniques:

  • Either testing the value of PS1 (before your assignment of course) it will not be set for non-interactive sessions, or
  • testing if $- contains i ; which will only happen for interactive sessions.

So your script would look like:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement