DerekTank
DerekTank

Reputation: 11

Why scp is not working when remote server is using zsh?

I compiled and installed zsh on server, and put the following line into .bashrc:

[ -f $ZSH/bin/zsh ] && exec $ZSH/bin/zsh -l

And zsh works well.

Then when I'm using scp from my local computer to copy some files to the server, like

$ scp test.txt user@server:~/

it would stuck forever, without any outputs.

And if I comment the shell line above in .bashrc, scp worked again.

Upvotes: 1

Views: 1550

Answers (2)

citiroller
citiroller

Reputation: 31

Put [ -f $ZSH/bin/zsh ] && exec $ZSH/bin/zsh -l in your .bash_profile not .bashrc.

.bash_profile is only sourced for interactive shells, .bashrc is sourced all the time. Even when you're just trying to execute a single command on the remote, e.g. scp instead of an interactive shell (ssh) and this leads to complications.

Upvotes: 3

Hackore
Hackore

Reputation: 183

Not sure if you've done this already but

if you DO have root access, make sure zsh goes in /etc/shells on all appropriate machines, including NIS clients, or you may have problems with FTP to that machine

From zsh-FAQ

Upvotes: 0

Related Questions