LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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, 08:48 AM   #1
maginotjr
Member
 
Registered: Aug 2004
Location: BR - Floripa
Distribution: Ubuntu 9.10 - 2.6.x.x
Posts: 661

Rep: Reputation: 34
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, 08:56 AM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,036

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
At the end of each user's ~/.bashrc file you could put cat ~/todolist
 
Old 01-26-2009, 09:43 AM   #3
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
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, 09: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: 34
thank you guys, very good advices!

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

Rep: Reputation: 163Reputation: 163
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 10:02 AM.
 
Old 01-26-2009, 10: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: 34
Code:
if [ -f /etc/motd.d/${USER} ]; then
     cat /etc/motd.d/${USER};
fi
 
1 members found this post helpful.
Old 01-26-2009, 10:20 AM   #7
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 163Reputation: 163
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, 01: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, 04:17 PM   #9
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 163Reputation: 163
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, 02: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


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


All times are GMT -5. The time now is 11:05 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration