LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 08-18-2008, 12:25 AM   #1
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534
Some SSH Questions


I am able to access a remote box on my home LAN using SSH. No problems getting into the box. I have denied root access and confirm this works as expected (I am asked repeatedly for a root password and get no further.). I can run X apps from the remote command line (when working remotely, having xfe installed is a handy compliment to the mc file manager ).

1. When I connect through SSH, my /etc/issue.net is NOT in color. I have escape codes embedded within the file. All I see with /etc/issue.net are the backslashes rather than the color represented by the escape sequences. I can type 'cat /etc/issue.net' at the local or remote command line and I see the colors. When I login locally at any box, the /etc/issue file displays in the expected colors and my shell prompts are in color. Shell script with commands in color also work fine. Therefore displaying colors is not an issue. Only with SSH, and only with /etc/issue.net. After I login through SSH, I see colors with my welcome message and prompt. How do I fix this lack of color with issue.net when using SSH?

2. I am sure that, once upon a time, when I accessed into a remote box through SSH, that the remote box presented me both /etc/issue and /etc/issue.net. This is no longer the case. Now I see only /etc/issue.net. How do I fix this?

In /etc/ssh/sshd_config I have the following set:

Protocol 2
PermitRootLogin no
AllowTcpForwarding yes
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
PrintMotd no
Banner /etc/issue.net
Subsystem sftp /usr/libexec/sftp-server

In /etc/ssh/ssh_config I have the following set:

Host *
ForwardAgent yes
ForwardX11 yes

After I obtain access to the remote box I verified the DISPLAY env. variable:

DISPLAY=localhost:10.0

Thanks.
 
Old 08-18-2008, 06:09 PM   #2
keefaz
Senior Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 4,617

Rep: Reputation: 136Reputation: 136
Maybe a SSH protocol issue with the client, the banner setting is available for SSH v2
Could you try ssh -vvv <your host> to see if it uses SSH v1 or v2 ?

Also banner setting is not a big deal, you could put that on .bashrc (if using bash shell) in home dir of the account you access with SSH:
Code:
if [ ! -z "$SSH_CONNECTION" ]; then
        cat /etc/issue.net
fi
I use the same if condition in my bashrc to set a SSH connection timeout (export TMOUT=600),
 
Old 08-21-2008, 06:11 PM   #3
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534
I'm using Slackware 12.1, fully patched. I'm using openssh-5.1, protocol 2.0. I have my sshd_config configured to only allow Protocol 2.

Running the -vvv option provided me no further clues about why the banner displays the actual escape codes rather than the colors represented by the escape codes. Hardly destructive but irritating. Especially when the escape codes are converted properly everywhere else within the ssh session.

I run a script in my rc.local to automatically update both /etc/issue and /etc/issue.net. As I shared in my original post, the colors embedded in /etc/issue display correctly, but not in issue.net, which is my ssh banner. The escape codes are exactly the same in both text files.

As a test, I modified my sshd_config to use /etc/issue as the banner rather than /etc/issue.net. Same result --- no colors. Only escape codes.

The problem seems to be a bug or oddball configuration problem with ssh or sshd_config. Any help is appreciated.

Quote:
Also banner setting is not a big deal, you could put that on .bashrc (if using bash shell) in home dir of the account you access with SSH:
Yes, that option might succeed and I might use that, but does not explain why the banner displays escape codes rather than the colors. This all worked for me at one time.
 
Old 08-21-2008, 07:27 PM   #4
keefaz
Senior Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 4,617

Rep: Reputation: 136Reputation: 136
Ah, I guess I did not read you well, sorry
/etc/issue.net seems to be parsed as it may contains some code like %s, %m etc
http://linux.die.net/man/5/issue.net
So maybe the parser function doesn't like escape codes and un-escape them before sending the message ?

Last edited by keefaz; 08-21-2008 at 07:30 PM. Reason: grammar
 
Old 08-22-2008, 10:21 PM   #5
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534
From this LFS page:

"There is also the file issue.net which can be used when logging on remotely. ssh however, will only use it if you set the option in the configuration file and will not interpret the escape sequences shown below." [Emphasis mine.]

After some quick testing I verified that ssh will not parse the backslash codes --- unlike login and /etc/issue. At the moment I am led to believe that ssh no longer supports parsing any type of escape code within the file specified by the sshd_config banner directive.

The problem is not agetty or login because colors work fine there.

I know the escape codes for color within issue.net succeeded at one time, otherwise I would not have created a colorized /etc/issue.net. I have not used ssh within my home LAN for a long time and therefore never noticed when this support discontinued.

I've long used an additional login script sourced within ~/.bash_profile. As you suggested, I modified that script to provide the color message I want based upon the $SSH_CONNECTION environment variable. I disabled the banner option in sshd_config to avoid duplication.

Thanks for helping.
 
  


Reply


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
2 questions about SSH yogaboy Linux - Security 15 12-20-2006 07:27 AM
SSH Questions Meabert Linux - Software 2 12-28-2005 02:24 AM
some SSH questions... nick1 Suse/Novell 2 03-23-2005 06:24 AM
SSH Questions Tezdread Linux - Networking 7 02-05-2003 05:34 PM
SSH Questions Stevy123 Linux - Networking 4 10-01-2002 06:52 PM


All times are GMT -5. The time now is 04:05 PM.

Main Menu
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