LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-05-2007, 06:42 PM   #1
Tux-Slack
Member
 
Registered: Nov 2006
Location: Slovenia
Distribution: Slackware 13.37
Posts: 511

Rep: Reputation: 37

How would u change your /etc/motd to say
Hello user
where user would be the username of the user that just logged in?
Is it doable by a bash script?
 
Old 06-05-2007, 08:29 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
I split your post out of the unrelated thread.


Cheers,
Tink
 
Old 06-06-2007, 04:08 AM   #3
Tux-Slack
Member
 
Registered: Nov 2006
Location: Slovenia
Distribution: Slackware 13.37
Posts: 511

Original Poster
Rep: Reputation: 37
Well thanks, I thought that for such a small quiestin is a faste of space to open a new thread, and it wasn't totaly unrelated :P
 
Old 06-06-2007, 05:38 AM   #4
ethics
Senior Member
 
Registered: Apr 2005
Location: London
Distribution: Arch - Latest
Posts: 1,522

Rep: Reputation: 45
Use the variable $USER?

so you can just echo $USER.

Works fine in my .bashrc, don't see why it shouldn't in the motd
 
Old 06-06-2007, 06:25 AM   #5
Tux-Slack
Member
 
Registered: Nov 2006
Location: Slovenia
Distribution: Slackware 13.37
Posts: 511

Original Poster
Rep: Reputation: 37
The motd is not a bash script, it just contains lines of ASCII text.
This is my current /etc/motd on the laptop:
Linux 2.6.20.7.
Offcourse on my server this is changed and now I want to mod it that way that in the end will say:
Wellcome to xy user
When someone will ssh to the serv
 
Old 06-06-2007, 02:35 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by Tux-Slack
Well thanks, I thought that for such a small quiestin is a faste of space to open a new thread, and it wasn't totaly unrelated :P
Takes up the same amount of space, and it *is* totally
unrelated. Thread-hijacking is poor practice.

And the file you want to look at for "interactive" login-
stuff is issue, not motd. motd is for static announcements.



Cheers,
Tink
 
Old 06-06-2007, 03:36 PM   #7
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
Actually, he is looking at the correct file. /etc/issue is displayed before a login, /etc/motd is displayed after a login. Also, /etc/issue.net is typically reserved for network logins, but it is often just a symlink to /etc/issue.

(In other words, he wouldn't know the username at the point of /etc/issue).

But, motd won't use variables, so you are stuck with putting something in /etc/profile or some such.

Last edited by forrestt; 06-06-2007 at 03:38 PM.
 
Old 06-06-2007, 07:00 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
I stand corrected in regards to issue :}


Cheers,
Tink
 
  


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
Rules to reflect thread subject guidelines? beaucoup LQ Suggestions & Feedback 1 03-05-2005 05:24 AM
Set the Xterm title to reflect the current time ! Bonch Linux - Newbie 11 10-25-2004 05:50 PM
Is there any MOTD software available besides /etc/motd? csif Linux - Software 1 04-24-2004 07:36 AM
how can i restrict /etc/motd for a specific user mtest Programming 8 10-30-2003 02:41 AM
MySQL user accounts. How do I modify them? correro Linux - Software 3 03-15-2003 08:39 PM


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