Welcome to Soft32 Linux Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

ssh works / scp fails - thanks to login script output !

 
   Soft32 Home -> Linux -> General Discussions RSS
Next:  Please unblock ckermit/211-11 (l10n update)  
Author Message
Kevin

External


Since: Jan 20, 2009
Posts: 1



(Msg. 1) Posted: Tue Jan 20, 2009 4:20 pm
Post subject: ssh works / scp fails - thanks to login script output !
Archived from groups: linux>redhat (more info?)

I need to transfer files between two servers on a regular basis (as a
cron job)

I got ssh to work, but scp kept failing. After troubleshooting, I
figured out that the reason was due to output being thrown by
the .bashrc on the remote server. Now, I cannot modify the remote file
output ; so what option do I have ? Can I somehow prevent the login
script from executing ?

If rsync is an option I am okay with that as well, but I ran into the
same issue with rsync as well Sad

-Kevin.
Back to top
Login to vote
Johnny Rebel

External


Since: Jan 05, 2009
Posts: 6



(Msg. 2) Posted: Tue Jan 20, 2009 8:15 pm
Post subject: Re: ssh works / scp fails - thanks to login script output ! [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Kevin wrote:
> I need to transfer files between two servers on a regular basis (as a
> cron job)
>
> I got ssh to work, but scp kept failing. After troubleshooting, I
> figured out that the reason was due to output being thrown by
> the .bashrc on the remote server. Now, I cannot modify the remote file
> output ; so what option do I have ? Can I somehow prevent the login
> script from executing ?
>
> If rsync is an option I am okay with that as well, but I ran into the
> same issue with rsync as well Sad
>
> -Kevin.


The OpenSSH FAQ has something to that affect in section 2.9

http://www.openssh.com/faq.html
<snip>
2.9 - sftp/scp fails at connection, but ssh is OK.

sftp and/or scp may fail at connection time if you have shell
initialization (.profile, .bashrc, .cshrc, etc) which produces output
for non-interactive sessions. This output confuses the sftp/scp client.
You can verify if your shell is doing this by executing:

ssh yourhost /usr/bin/true

If the above command produces any output, then you need to modify your
shell initialization.
<snip>

Not sure what else to say! Not sure how rsync would handle that - you
may have the same issue.

JR.


--


--> GNU/Linux is user friendly... it's just picky about its friends.
Back to top
Login to vote
noi ance

External


Since: Jul 18, 2007
Posts: 67



(Msg. 3) Posted: Wed Jan 21, 2009 3:20 pm
Post subject: Re: ssh works / scp fails - thanks to login script output ! [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Tue, 20 Jan 2009 16:20:35 -0800, Kevin typed this message:

> I need to transfer files between two servers on a regular basis (as a
> cron job)
>
> I got ssh to work, but scp kept failing. After troubleshooting, I
> figured out that the reason was due to output being thrown by the
> .bashrc on the remote server. Now, I cannot modify the remote file
> output ; so what option do I have ? Can I somehow prevent the login
> script from executing ?
>
> If rsync is an option I am okay with that as well, but I ran into the
> same issue with rsync as well Sad
>
> -Kevin.

Johnny is correct this usually happens when the remote displays messages
on login, like MOTD, Welcome, etc.
Back to top
Login to vote
Thomas P Brisco

External


Since: Jun 17, 2007
Posts: 6



(Msg. 4) Posted: Sun Feb 01, 2009 8:25 am
Post subject: Re: ssh works / scp fails - thanks to login script output ! [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Tue, 20 Jan 2009 16:20:35 -0800, Kevin wrote:

> I need to transfer files between two servers on a regular basis (as a
> cron job)
>
> I got ssh to work, but scp kept failing. After troubleshooting, I
> figured out that the reason was due to output being thrown by the
> .bashrc on the remote server. Now, I cannot modify the remote file
> output ; so what option do I have ? Can I somehow prevent the login
> script from executing ?
>
> If rsync is an option I am okay with that as well, but I ran into the
> same issue with rsync as well Sad
>
> -Kevin.

You should be able to work around this a bit by "proper use" of the
config files -- essentially, put noisy stuff into .bash_profile, and per-
shell initialization stuff in .bashrc.

From "man bash" (FILES section)
.bashrc
the individual per-interactive-shell startup file
.bash_profile
the personal initialization file, executed for login shells

the stuff sending the output (obviously only good for human logins) can
be moved to the .bash_profile.

(I ran into this some years ago with csh....)

rsync won't help (I think) -- since it really only calls scp underneath
the wraps....
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Redhat EL4 WS on HP xw9400 eth0 link fails eth1 works. - Bit of a strange one. This is with Redhat EL4 WS on an HP xw9400. I plugged this box in our network and it worked fin...

(cluster) Resource type script.. the script repeats after .. - Hi, I have successfully configured a two node cluster. The cluster contains a service attached to a prioritized..

KDE Login Screen won't allow for root login on Fedora 3 - Hey everyone, I just switched my login screen from GNOME to KDE and now it won't allow root login. It says "Root ...

mailing command output? - I'm sure this is a no-brainer, but supposing I want to setup a script that runs a command and mails the ouput to an..

Problems getting output from C/C++ programs - I'm running kernel 2.2.5-15 (I think from Linux v 6.2) with gcc-2.91.66. I can compile *.c and *.cpp programs, but..

[Q] iostat output question??? - We have several servers installed Redhat AS 2.1 (update 3). I use "iostat -x 5" to check I/O performance. I...
       Soft32 Home -> Linux -> General Discussions All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Categories:
 Windows
  Linux
 Mac
 PDA


[ Contact us | Terms of Service/Privacy Policy ]