DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 12th July 2018
fvgit's Avatar
fvgit fvgit is offline
Tempvs fvgit
 
Join Date: May 2016
Location: perl -MMIME::Base64 -le 'print decode_base64("SGVyZSBiZSBkcmFnb25zC")'
Posts: 151
Default Different motd depending on how I login (e.g. Console vs ssh)?

/etc/login.conf only seems to differentiate between login classes, but I'd like to set up a different motd for the same user depending on where he logs in. I know I can set up an if-statement in ~/.profile that checks $TERM. Is there a way to achieve this system-side?
Reply With Quote
  #2   (View Single Post)  
Old 13th July 2018
jggimi's Avatar
jggimi jggimi is online now
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 6,377
Default

login.conf(5) lists a series of program entries: approve, approve-service, classify, passwordcheck, and shell. You may be able to develop and deploy a programmatic solution using one of these.
Reply With Quote
  #3   (View Single Post)  
Old 13th July 2018
fvgit's Avatar
fvgit fvgit is offline
Tempvs fvgit
 
Join Date: May 2016
Location: perl -MMIME::Base64 -le 'print decode_base64("SGVyZSBiZSBkcmFnb25zC")'
Posts: 151
Default

Thank you for the pointer, jggimi. Much appreciated! I'll look into it and see if I can figure sth. out. Although, I may have to get back to the topic with more questions.

Will report back either way.
Reply With Quote
  #4   (View Single Post)  
Old 16th July 2018
fvgit's Avatar
fvgit fvgit is offline
Tempvs fvgit
 
Join Date: May 2016
Location: perl -MMIME::Base64 -le 'print decode_base64("SGVyZSBiZSBkcmFnb25zC")'
Posts: 151
Default

Sometimes the solution is easier than it seems.

Instead of trying to write a classification script to be used with login.conf where I'm not exactly sure I would've really known what I'm doing, I stumbled across a much easier solution by modifying two lines in /etc/ssh/sshd_config:
Code:
(...)
PrintMotd no
Banner /etc/ssh.motd
The first line suppresses the regular system motd while the second contains a path to a different motd file that gets displayed instead.

Now the same user sees /etc/motd when logging in on the console and /etc/ssh.motd when logging in through ssh. Problem solved.

Last edited by fvgit; 16th July 2018 at 12:59 AM. Reason: typo
Reply With Quote
Reply

Thread Tools
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
can't login on virtual console spermwhale_warrior OpenBSD General 3 19th July 2014 05:05 PM
console configuration hanzer OpenBSD General 14 15th December 2013 12:21 AM
Console problem sniper007 FreeBSD General 3 20th February 2010 03:44 PM
log in to console and startx in os x questionguy Other BSD and UNIX/UNIX-like 11 25th August 2009 05:27 AM
Console Fonts JMJ_coder General software and network 6 10th September 2008 09:57 PM


All times are GMT. The time now is 07:23 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick