scp does not work: wrong bashrc

When I tried to use scp to copy a file on a distant machine:

scp -v filename username@xxx.xxx.xxx:/home/username

it looked as if the SCP command works but the file is not copied. The interactive option (-v) does not provide any hints.

The problem seems to reside in the bash environment. If I remove the different parts of the bashrc, it works. So, you need to disable the bashrc. It seems to be known that when called by SSH, an SCP command calls the user’s login shell. To disable it, add this line in the .bashrc file in the home directory:

[ -z "$PS1" ] && return
Please follow and like us:
This entry was posted in Linux and tagged , , . Bookmark the permalink.

3 Responses to scp does not work: wrong bashrc

Leave a Reply

Your email address will not be published. Required fields are marked *