View previous topic :: View next topic |
Author |
Message |
Jeedo Apprentice
Joined: 02 May 2003 Posts: 202 Location: Akureyri, Iceland
|
Posted: Sun Oct 19, 2003 5:51 pm Post subject: Editing /etc/issue and /etc/motd to get a cooler login. |
|
|
Here are a cauple of cool tricks for customizing your login process.
1. Customizing /etc/issue
/etc/issue is the text that is displayed before any user is able to log on the system, the default output on Gentoo is:
Code: |
This is \n.\O (\s \m \r) \t
|
Which translates to:
Quote: |
This is hostname.iso-domain (kernel arch version) HH:MM:SS
|
What i did there was add a ASCII picture to the file as well as changing the description line slightly
Code: |
,:.:.:. . . .H. "PA, .:IHH:HHII::.
,:.::... .. A:I:::";, . . ,ILIIIH:HI:I:I;
,;:.:.:.. . . .H:TP"VB').. .,;T;,,::I:HI:I:::
,::.:.:.. . . AI:.":IAAT:. .(':BB');V::IH:I:I;
,::.:.:.. . . .H:. ' . . .. .":;AITP;I:IIH:I::;,
,::.::.:. . . . A::. . ..:. . . ..:AI:IHII:I::;.
;:.::.:.. . . AM:I:. ..:. .: . .::HIIIHIIHII::.
,:::.:.:.. . .MM:I:.. .:, .:. .::HHIIIHIHII::'
,::.:..:.. . . AMM:I:. . .'"-""''. ..::HIHI:HI:III:
;:.::..:.. . . AMMM::. . ,,,, '.. '.::IMHIHIHIIHI::;
,:::.:..:. . . MMMM:I:. ':::;;;::;' .::AMHIHIHHIHHI:"
;::.:.:.. . . .:VMMV:A:. . ':;,,." .::AMMMIHIHHIHHII
;::.:.:.. .. . .::VM:IHA:. .'' ' . ..:AMMMMHIHHHIHHII:
;:::.:.. . .. . .::P::IHHAA.. . .. .:AMMMMMMMIIHHIHHI::
;::.:.. . . . ..:.:VIHHHIHHA::,,,,,:AMMMMMMMMMHIIHHHHII;
;.::.. . . . ..:.:VHHIHI:IHIHHIHI:MMMMMMMMMMHIHHIHHII:
::.:.. . .. ...:.::VHI:IIVIHIHII:MMMMMMMMMMMIHHIHHII:,
;:..:. . .. . ..:.::::VAII:IIIIII:MMMMMMMMMMMIHHIIHIIHI
';:.. . . .. ..:...:.VII::III:.VMMMMMMMMMHIHHHIHI::I,
;:. . . ' . .. ... . .::.::V::II:..VMMMMMMMMHIHHHIHI::I;
;:.. . . . .. ..:.. .::...:VIITPL:VMMMMMMMVIHHHIH:. :;
;:. . . . .. ... . ..:.:.. .:IIIA:.MMMMMVI:HIHIH:. .:
I:. . . . .. . .. . . . . ..:.. ..::IIA.VMMMVIHIIHIV:. .'
I:.. . . .. .... . . . .. ... .:.:IA:.VMVIMHIHIH:..:
I.. . . . ..... . . . .. . .. .:IIAV:HIMHHIHII:.'
:. .. . . .:.. . . .. ... ..::.:CVI:MHHIHHI...
:.. . . .. ..:. . . ... .:.:::VHA.VIHHMI:..
:. .. . . ..:.. . . . . .. .. ...:VIIHIHI: .
':.. . . .::. . .::,. . . . . ...V:IHII..
;:.. .. .:I:. ..:T"::. . . . . . . .VIIH:.
;:.:.. .:I:.. .::V:::. . . . . . VIII..
;:.. ..::::. . ..::. . . . .. . . . VIII.
I:.:.. .:I:. ..:.' . . .. :. . . "VI:.
I::......::. . . .. .:.:.:. . "I:
II::.. ..::. . . . . .. .. .::::.. . .:.
II::.:. ..::. . . . . . .:. . .:I:::. . .::HD
'I:::.. .: . .. .. .. . . . .::. . .:I:. . .:V:
I:. .. . . . ... .. .. . . .. .. ..::. .:.
I:.. .. . ..:.. .. .. .. . . . . . :
;:.... . ..:::I:.. ..:.. ... .::. . ... . .. .I.
::.:....::.::I:III:I::::I:II:I::.. .:.. . .:. . . . .AI:
'::.:...:..::::::III::II::::::.. ...::. . .::. . .. . .AMMI.
:::.:.:. ..::::III:II:I:::.:. .. ..::.. .. ..::,. ..::HMMI:
':::.:.. ...::I:::I:I:::.:.. :. . ..::.. . . . .'PTIHI:IIHHI:.
::I::.:...:::II:I::.:....:.:. . ...::. . . . .AI:IHI'':' '.
':::.:... ..I::I::.:....:. .: .. ...::. . . III:II:. '
'I:::..:...:.::I::.:..:. .: .. . ..:... . . III.I'
VI:::.::.::...:II::...:...:. . . .:::. . . :''
'HI:I::.::.::..:II::.:..:.... . .:.:I:.. . :
VI:I:I::.::.:...:I:::I:::.... ..:.:I::... :
This is \n (Gentoo GNU/\s \m \r) \t
|
more pictures can be found here: http://212.30.222.56/tmp/ascii-pics.tar.gz (temp url) and http://www.simnet.is/velfag/tmp/ascii-pics.tar.gz (will be up once my isp is up again.)
2. Making /etc/motd dynamic
/etc/motd is message of the day, it is displayed right after the user has entered his or her password.
This is just one of many things that can be done:
First,
and then
Code: |
emerge fortune-mod cowsay
|
as well as any quote archives you want
Then
Code: |
ls /etc/runlevels/default/
|
If the runlevel "local" is not on that list then do
Code: |
rc-update add local default
|
and
Code: |
echo "fortune | cowsay -f bunny > /etc/motd" >> /etc/conf.d/local.start
|
This is presuming you want the "bunny-cow" by cowsay,
Another way to do this, especially if you don't reboot every day like i do is to add the same line to an executable script in /etc/cron.daily
Anyway if you did it right you should get something like:
Code: |
Rancorwe login:
Password:
Last login: Sun Oct 19 19:41:58 2003 from goongsang
_____________________________________
/ If you think things can't get worse \
| it's probably only because you lack |
\ sufficient imagination. /
-------------------------------------
\
\ \
\ /\
( )
.( o ).
jeedo@Rancorwe ~ $
|
Anyway those were just two simple examples of what can be done, it would be great though if everybody who have some other customizations would post their /etc/issue and /etc/motd, as well as any scripts and programs to create them dynamically. |
|
Back to top |
|
|
Headhunter123 Guru
Joined: 19 Oct 2002 Posts: 509
|
Posted: Mon Oct 20, 2003 10:22 am Post subject: |
|
|
Hi!
Cool tips, thanks
One improvement for your cowsay thing, what about showing a random cow each time?
Try this script (it isn't mine, I have it from some guy from #gentoo.de, don't ask me who it was, anyway, he deserves the credits, not me)
#!/bin/sh
cowsay -f $(perl -le 'opendir COWS, "/usr/share/cowsay-3.03/cows/";push @a, $_ foreach readdir COWS;closedir COWS;$a[int rand $#a]=~/(.*)\.cow/;print $1') $1joj |
|
Back to top |
|
|
dub.wav Tux's lil' helper
Joined: 09 Apr 2003 Posts: 149 Location: Norway
|
Posted: Mon Oct 20, 2003 12:08 pm Post subject: |
|
|
Another suggestion:
Code: |
emerge linux-logo
linux_logo -L 3 > /etc/issue (back up /etc/issue first)
|
You'll then have a gentoo logo in your /etc/issue. There are a few different logos in linux_logo...linux_logo -L 1 gives you a linux penguin with a white/grey background, -L 2 a penguin with a black background, etc. |
|
Back to top |
|
|
zeky Guru
Joined: 24 Feb 2003 Posts: 470 Location: Vukojebina, Europe
|
Posted: Mon Oct 20, 2003 5:16 pm Post subject: |
|
|
You have to love that pretty ASCII login pic :p _________________ Beat your dick like it owes you money |
|
Back to top |
|
|
cybe n00b
Joined: 22 Jul 2003 Posts: 67 Location: Finland
|
Posted: Mon Oct 20, 2003 8:23 pm Post subject: |
|
|
Why not ANSI graphics to give you that; "uh is it 1994 and I'm logging in to a BBS" feeling? grab some .ANS files and cat them (an ANSI font is needed) _________________ _________________________________
The MOST important book on the planet?
http://thewayhomeorfacethefire.info/ |
|
Back to top |
|
|
Jeedo Apprentice
Joined: 02 May 2003 Posts: 202 Location: Akureyri, Iceland
|
Posted: Mon Oct 20, 2003 11:14 pm Post subject: |
|
|
Headhunter123 wrote: | Hi!
Cool tips, thanks :)
One improvement for your cowsay thing, what about showing a random cow each time?
|
I was going to do that, however i didnt know how, but you've just helpfully told me;) |
|
Back to top |
|
|
ecatmur Advocate
Joined: 20 Oct 2003 Posts: 3595 Location: Edinburgh
|
Posted: Wed Oct 22, 2003 12:44 pm Post subject: |
|
|
If you don't want to fire up perl, Code: | cows=(/usr/share/cowsay*/cows/*.cow)
cowsay -f ${cows[$(($RANDOM%${#cows}))]} | will work in a bash script, e.g. my /etc/cron.hourly/motd-maker: Code: | #! /bin/bash
if [ -x "$(which cowsay)" ]; then
cows=(/usr/share/cowsay*/cows/*.cow)
modes=("-b" "-d" "-g" "-s" "-t" "-w" "-y" "")
filter="cowsay -f ${cows[$(($RANDOM%${#cows}))]} ${modes[$(($RANDOM%${#modes}))]}"
else
filter="cat"
fi
if [ -x "$(which fortune)" ]; then
producer="fortune"
else
producer="uname -a"
fi
$producer | $filter > /etc/motd |
|
|
Back to top |
|
|
Neelix n00b
Joined: 24 Oct 2003 Posts: 3
|
Posted: Fri Oct 24, 2003 9:54 am Post subject: The real solution for a fortune motd |
|
|
Together with a friend of mine I went in and finally made a real script to do this. There's two seperate ones in here, do with it what you will, but it works for me
The script that does the job (put it in /usr/local/bin/fortuned):
Code: |
#! /usr/bin/env perl
# Fortune Daemon
# Variable setup
$myPipe="/etc/motd";
$myFortune="/usr/bin/fortune";
$myPidFile="/var/run/fortuned.pid";
# Make the pipe or die trying.
if (! -p $myPipe) {
!`mkfifo $myPipe` or die "could not create $myPipe, stopped at";
}
# Fork, child goes on to become a fortune daemon
# Parent writes the PID to the pid-file and terminates.
if (! ($myPid=fork()) ) {
while(1) {
open(PIPE,">$myPipe") or die "could not open $myPipe, stopped at";
print PIPE `$myFortune`."\n";
close(PIPE);
sleep(1);
}}
# Before the parent dies, it cleans up after its child.
else {
open(OUTFILE, "> $myPidFile");
print OUTFILE "$myPid";
close(OUTFILE);
}
|
This script runs in the background and writes a new fortune to /etc/motd.
To turn this all on and off at will, there's this init.d script:
Code: |
#!/sbin/runscript
# This is some belony info, but for some reason something needs
depend() {
use logger
need net
}
checkconfig() {
if [ ! -e /usr/local/bin/fortuned ] ; then
eerror "no fortuned present"
return 1
fi
}
start() {
checkconfig || return 1
ebegin "Starting fortuned"
start-stop-daemon --start --quiet --exec /usr/local/bin/fortuned
eend $?
}
stop() {
ebegin "Stopping fortuned"
start-stop-daemon --stop --quiet --pidfile /var/run/fortuned.pid
rm /etc/motd
eend $?
}
|
Known issue:
The generating part takes a second off before sending a new fortune to the pipe. This is so that the receiving end knows when to stop.
The effect of this is that you can't log in simultaneously, but one of you would have to wait just a second. |
|
Back to top |
|
|
Neelix n00b
Joined: 24 Oct 2003 Posts: 3
|
Posted: Fri Oct 24, 2003 10:10 am Post subject: |
|
|
One word of caution if you go experimenting wit this:
Be really sure that something comes out of the pipe at /etc/motd.
If nothing comes out and you reboot, you've just succesfully locked yourself out of your box. So then it's time to get your LiveCD out again and fix it, or find some other means to do it. |
|
Back to top |
|
|
b1nd3n14l Tux's lil' helper
Joined: 06 Jun 2003 Posts: 80
|
Posted: Thu Feb 05, 2004 6:10 pm Post subject: |
|
|
The perl script for the pipe of /etc/motd rocks!
Thanks dude... _________________ Later...Gator...
First ever Gentoo Install: June 5th , 2003
Registered User #12078 at http://counter.li.org |
|
Back to top |
|
|
ett_gramse_nap Apprentice
Joined: 01 Oct 2003 Posts: 252 Location: Göteborg, Sweden
|
Posted: Thu Feb 05, 2004 6:51 pm Post subject: |
|
|
Lovely! I've never thought about this! Really cool to be offended by a cow everytime one logs on! _________________ Don't bother! |
|
Back to top |
|
|
monotux l33t
Joined: 09 Sep 2003 Posts: 751 Location: Stockholm, Sweden
|
Posted: Fri Feb 06, 2004 9:18 am Post subject: |
|
|
I think someone should take a look how slackware does their random quote @ login - thats the only thing I miss with slackware :-/ _________________ Computer science is no more about computers than astronomy is about telescopes. |
|
Back to top |
|
|
pYrania Retired Dev
Joined: 27 Oct 2002 Posts: 650 Location: Cologne - Germany
|
Posted: Sat Feb 07, 2004 12:50 pm Post subject: |
|
|
Guess this might be the right thread to ask..
I've the following /etc/issue file on all my boxes, but as you might notice, the box end pipes are not aligned by default, because of different hostname and kernel version lenghts.
I thought about hacking up a script that dynamically draws the box and fills it with whatever needed number of whitespaces. The script could be called from local.start so it's always up to date. however i didn't have the time to hack this script up yet. Any volunteers?
Code: | ^[[H^[[J
^[[1;33;40m
oooo$$$$$$$$$$$$oooo
oo$$$$$$$$$$$$$$$$$$$$$$$$o
oo$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$o o$ $$ o$
o $ oo o$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$o $$ $$ $$o$
oo $ $ "$ o$$$$$$$$$ $$$$$$$$$$$$$ $$$$$$$$$o $$$o$$o$
"$$$$$$o$ o$$$$$$$$$ $$$$$$$$$$$ $$$$$$$$$$o $$$$$$$$
$$$$$$$ $$$$$$$$$$$ $$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$ $$$$$$$$$$$$$$ """$$$
"$$$""""$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ "$$$
$$$ o$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ "$$$o
o$$" $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$o
$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" "$$$$$$ooooo$$$$o
o$$$oooo$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ o$$$$$$$$$$$$$$$$$
$$$$$$$$"$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$""""""""
"""" $$$$ "$$$$$$$$$$$$$$$$$$$$$$$$$$$$" o$$$
"$$$o """$$$$$$$$$$$$$$$$$$"$$" $$$
$$$o "$$""$$$$$$"""" o$$$
$$$$o o$$$"
"$$$$o ^[[0;31;40mo$$$$$$o"$$$$o^[[1;33;40m o$$$$
"$$$$$oo ^[[0;31;40m""$$$$o$$$$$o^[[1;33;40m o$$$$""
""$$$$$oooo ^[[0;31;40m"$$$o$$$$$^[[1;33;40m$$$$"""
""$$$$$$$oo ^[[0;31;40m$$$$$$$$$$^[[1;33;40m
""""^[[0;31;40m$$$$$$$$$$$^[[1;33;40m
^[[0;31;40m$$$$$$$$$$$$^[[1;33;40m
^[[0;31;40m$$$$$$$$$$"^[[1;33;40m
^[[0;31;40m"$$$""""^[[1;37;40m
,-----------------------------------------------.
| System OS: Gentoo Linux |
| Kernel...: \s-\r |
| FQDN.....: \n.\O |
| Admin....: Markus Nigbur <pYrania@gentoo.org> |
`-----------------------------------------------'
^[[0;37;40m
|
_________________ Markus Nigbur |
|
Back to top |
|
|
linux_girl Apprentice
Joined: 12 Sep 2003 Posts: 287
|
Posted: Sat Jun 11, 2005 2:23 pm Post subject: |
|
|
furiorc wrote: | I think someone should take a look how slackware does their random quote @ login - thats the only thing I miss with slackware :-/ |
may be because they moded the /bin/login to use fortune with is prety bas idea (buffer overflow ....) _________________ |
|
Back to top |
|
|
blue.sca l33t
Joined: 28 Aug 2003 Posts: 680 Location: Mainz, Germany
|
Posted: Sat Jun 11, 2005 9:51 pm Post subject: |
|
|
pYrania wrote: | Any volunteers? :) |
No way!!! :) _________________ geek by nature, linux by choice
i want my avatar back... thank you
:wq |
|
Back to top |
|
|
tom56 Guru
Joined: 27 Apr 2004 Posts: 325 Location: united kingdom
|
Posted: Sun Jun 12, 2005 1:04 pm Post subject: |
|
|
Am I the only one who thinks the picture at the top of this is page is inappropriate? IMO the fact that it is in ASCII doesn't make it any more or less suitable. _________________ "A million surplus Maggies are willing to bear the yoke; And a woman is only a woman, but a good cigar is a Smoke" -- Rudyard Kipling (on why he chose cigars over his wife) |
|
Back to top |
|
|
j-m Retired Dev
Joined: 31 Oct 2004 Posts: 975
|
Posted: Sun Jun 12, 2005 1:36 pm Post subject: |
|
|
tom56 wrote: | Am I the only one who thinks the picture at the top of this is page is inappropriate? IMO the fact that it is in ASCII doesn't make it any more or less suitable. |
Yes, probably you are the only one... |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54808 Location: 56N 3W
|
Posted: Sun Jun 12, 2005 1:47 pm Post subject: |
|
|
ecatmur,
Thats hard work, why not add
Code: | # run fortune at login
echo
fortune
echo | to the end of /etc/bash/bashrc ?
Every login gets a new fortune _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
tom56 Guru
Joined: 27 Apr 2004 Posts: 325 Location: united kingdom
|
Posted: Sun Jun 12, 2005 6:28 pm Post subject: |
|
|
j-m wrote: | tom56 wrote: | Am I the only one who thinks the picture at the top of this is page is inappropriate? IMO the fact that it is in ASCII doesn't make it any more or less suitable. |
Yes, probably you are the only one... |
That's what I thought
Personally I don't find it offensive, I'm just aware that there are other people who might. _________________ "A million surplus Maggies are willing to bear the yoke; And a woman is only a woman, but a good cigar is a Smoke" -- Rudyard Kipling (on why he chose cigars over his wife) |
|
Back to top |
|
|
elchino n00b
Joined: 17 Jun 2005 Posts: 2 Location: /dev/null
|
Posted: Fri Jun 17, 2005 1:06 pm Post subject: |
|
|
NeddySeagoon wrote: | ecatmur,
Thats hard work, why not add
Code: | # run fortune at login
echo
fortune
echo | to the end of /etc/bash/bashrc ?
Every login gets a new fortune |
When you mess with ~/.bashrc, you put scp's in jeopardy.
I used to do what you suggested, but scping where it required me to give my Gentoo-box's login info failed every time.
/etc/motd is definitely the way to go.
I currently have a cronjob that refreshes /etc/motd every 60 seconds. You don't necessarily get a new fortune every login, but I don't usually start new sessions that frequently.
[edit] added an apostrophe in the first line of my post [/edit] _________________ I'll never forget the first time I used Windows, but I'm still trying... |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54808 Location: 56N 3W
|
Posted: Fri Jun 17, 2005 2:31 pm Post subject: |
|
|
elchino,
I didn't suggest ~/.bashrc and yes, you can mess up ssh. I have a few headless boxes wth that /etc/bash/bashrc modification. ssh is fine here. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
raccoon n00b
Joined: 28 Apr 2004 Posts: 36 Location: Wonderland
|
Posted: Wed Sep 14, 2005 7:58 am Post subject: |
|
|
Great tutorial! Just thought I'd let you know about a typo;
Quote: | If the runlevel "local" is not on that list then do... |
"local" is the script name, and "default" is the runlevel - not the other way around :) _________________ Adopt an unanswered post! |
|
Back to top |
|
|
nonas Guru
Joined: 17 Apr 2005 Posts: 328
|
Posted: Wed Sep 14, 2005 12:31 pm Post subject: |
|
|
Does somebody have any details about [colors/bold/italic/whatever] codes used in these files ?
I saw this information once but can't find it again... |
|
Back to top |
|
|
raccoon n00b
Joined: 28 Apr 2004 Posts: 36 Location: Wonderland
|
|
Back to top |
|
|
nonas Guru
Joined: 17 Apr 2005 Posts: 328
|
Posted: Wed Sep 14, 2005 5:54 pm Post subject: |
|
|
Thanks a lot
*bookmarked* |
|
Back to top |
|
|
|