LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-26-2009, 07:48 AM   #1
maginotjr
Member
 
Registered: Aug 2004
Location: BR - Floripa
Distribution: Ubuntu 9.10 - 2.6.x.x
Posts: 661

Rep: Reputation: 35
Question motd or login banner per user


Hi...

I want to show for each user that login through ssh an specific message, like a todo list for that specific user, I know that I can user /etc/motd or /etc/issue to display a message system wide but I don't know how to do the same only for an specific user...
can anyone help me on that?

thkx!
[ ]ś
 
Old 01-26-2009, 07:56 AM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
At the end of each user's ~/.bashrc file you could put cat ~/todolist
 
Old 01-26-2009, 08:43 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
In alternative to what suggested by tredegar (which is an excellent advice, anyway) you can create a directory under /etc containing custom welcome messages for each users and put the username in the name of each file. For example:
Code:
# ls /etc/welcome
welcome_colucix     welcome_maginotjr     welcome_tredegar
then in /etc/bashrc (or equivalent) add the following line at the end
Code:
test $TERM == xterm && cat /etc/welcome/welcome_$USER
in this way you can mantain your list of MOTD without writing in each user's home directory every time you have to change them.
 
1 members found this post helpful.
Old 01-26-2009, 08:52 AM   #4
maginotjr
Member
 
Registered: Aug 2004
Location: BR - Floripa
Distribution: Ubuntu 9.10 - 2.6.x.x
Posts: 661

Original Poster
Rep: Reputation: 35
thank you guys, very good advices!

best regards and thks again,
[ ]'s
 
Old 01-26-2009, 09:01 AM   #5
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
Quote:
Originally Posted by maginotjr View Post
thank you guys, very good advices!

best regards and thks again,
[ ]'s
One last point, make sure you put in some kind of check to see if the file exists before attempting to display it or your users will see errors (colucix did this with test, just make sure you include a similar mechanism.)

Last edited by rweaver; 01-26-2009 at 09:02 AM.
 
Old 01-26-2009, 09:13 AM   #6
maginotjr
Member
 
Registered: Aug 2004
Location: BR - Floripa
Distribution: Ubuntu 9.10 - 2.6.x.x
Posts: 661

Original Poster
Rep: Reputation: 35
Code:
if [ -f /etc/motd.d/${USER} ]; then
     cat /etc/motd.d/${USER};
fi
 
2 members found this post helpful.
Old 01-26-2009, 09:20 AM   #7
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
Quote:
Originally Posted by maginotjr View Post
Code:
if [ -f /etc/motd.d/${USER} ]; then
     cat /etc/motd.d/${USER};
fi
Yeap!
 
1 members found this post helpful.
Old 11-19-2009, 12:41 PM   #8
sebasyan
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Rep: Reputation: 0
remove motd after ftp login

Hey guys, do you know how to avoid printing the motd banner after successfull ftp login?

Thanks,

Sebas
 
Old 11-19-2009, 03:17 PM   #9
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
Quote:
Originally Posted by sebasyan View Post
Hey guys, do you know how to avoid printing the motd banner after successfull ftp login?

Thanks,

Sebas
That would depend on what ftp server you're using. Some don't print the motd banner at all and some use a special banner in the ftp root or a different file entirely.

What ftp daemon are you using?
 
1 members found this post helpful.
Old 03-09-2012, 01:08 PM   #10
centuren
LQ Newbie
 
Registered: Mar 2012
Location: California
Distribution: Kubuntu, Debian
Posts: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by tredegar View Post
At the end of each user's ~/.bashrc file you could put cat ~/todolist
Putting this in a user's ~/.bashrc file will the output on every new instance of bash (including sudo bash) rather than just on connect. Using ~/.profile instead is a better option, if this is a desired approach (e.g. someone wants a nice msg when connection to a system on which they have no admin access).
 
1 members found this post helpful.
  


Reply



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
How to setup system Login banner and Login message 06-03-05 Linux - Newbie 13 07-24-2020 02:05 PM
Easy ? New to MOTD Text does not appear after login mccartjd Linux - Newbie 3 05-19-2008 01:21 AM
show motd on login pirozzi Debian 11 12-15-2004 10:40 AM
why does /etc/motd print twice at login SuSE9.0 ?? jdaniel Linux - Software 4 10-26-2004 01:34 PM
Login Message following MOTD kipbenson4 Linux - Newbie 5 08-05-2003 09:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:33 PM.

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
Open Source Consulting | Domain Registration