LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 05-15-2009, 04:31 PM   #1
frznchckn
Member
 
Registered: Jun 2006
Location: CA
Distribution: Ubuntu, CentOS, Scientific Linux
Posts: 97

Rep: Reputation: 15
Question banners and scp


Part of some security requirements I have to implement on the computers I SA for is to have a banner display a message upon login.

The problem is that this banner will break scp connections. Is there a workaround for this?
 
Old 05-15-2009, 04:42 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
Why will it break it? If it did then it wouldn't be possible to show it, would it? Works fine for me, maybe you could clarify what you mean?
 
Old 05-15-2009, 04:46 PM   #3
frznchckn
Member
 
Registered: Jun 2006
Location: CA
Distribution: Ubuntu, CentOS, Scientific Linux
Posts: 97

Original Poster
Rep: Reputation: 15
I remember having this issue whenever my .bashrc printed something to the screen. Whenever I would try to perform an scp I would get the following:

protocol error: unexpected <newline>

If a banner is printed to the screen after a successful login, won't it break scp with this "unexpected <newline>"?
 
Old 05-15-2009, 04:50 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
how does your bashrc involved in this? scp doesn't spawn a bash shell, so that wouldn't get executed. just enable a banner in /etc/ssh/sshd_config and off you go.
 
Old 05-15-2009, 05:08 PM   #5
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
I don't know the scp internals, but .bashrc is invoked upon scp connections. If I put an echo in .bashrc, it will be executed and the scp command fails. If I put an echo in .profile (or .bash_profile) it will not be executed upon scp, but still remains for ssh connections (since they start a login shell). So you have two alternatives:

1) put the banner in /etc/profile
2) enable the Banner option in sshd_config as suggested by acid_kewpie above
 
Old 05-15-2009, 05:23 PM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
i tried an scp with an echo in my .bashrc and it did nothing, on Ubuntu 8.10. Odd.
 
Old 05-15-2009, 05:38 PM   #7
frznchckn
Member
 
Registered: Jun 2006
Location: CA
Distribution: Ubuntu, CentOS, Scientific Linux
Posts: 97

Original Poster
Rep: Reputation: 15
Thumbs up

Thanks, I got the banner working without breaking scp using the sshd_config setting.

acid_kewpie, did you have a newline in the text you echoed?
 
  


Reply

Tags
banner, scp


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
scp does not work and gives the following error message: scp: FATAL: Executing ssh1 i akay Linux - Networking 16 09-29-2008 12:41 AM
Variables Used in Banners Palula Linux - Newbie 3 11-03-2005 09:55 AM
how do I create anamated banners ??? BaerRS Linux - General 4 05-30-2002 06:44 PM
Banners Eternal LQ Suggestions & Feedback 4 03-17-2002 10:39 AM
Banners SkYzOpReNiCk LQ Suggestions & Feedback 1 10-14-2001 03:11 PM


All times are GMT -5. The time now is 07:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration