does anybody her know off hand how to make the UNIX box (Freebsd 4.3) display messages when you get a login prompt? Looked everywhere and couldn't find it
Printable View
does anybody her know off hand how to make the UNIX box (Freebsd 4.3) display messages when you get a login prompt? Looked everywhere and couldn't find it
Hey dude just edit the /etc/motd file.
I DO need to change /etc/motd but what I want to do is get the box to display a message when a user sees a login prompt (ex. an unauthorised usage warning)Quote:
Oh ok heres how yah do it then
Create a file with the message you wish to display, say /etc/issue. Give it 644 permissions.
Open (as root) /etc/gettytab with a text editor and add to the section that says "default" if=/etc/issue: and save the file. Note that the entries are separated by colons and the section ends with a colon Instead of using if as in 2a, add your message to the im variable and put a \n after it for a newline. You can do this before or after the other stuff, which determines whether it will come before or after the line listing the operating system and so forth. Be sure you don't split the "default" line into more than one line; use \r, \n, and \t to format your message. Beware pico, with its automatic wrap. You should not need to get gettytab reread by restarting init, which you could do either by rebooting (a last resort) or sending init a signal to restart with kill -1 1 (init is always process 1). Note that you can't test by logging in from an existing prompt; you need to test it from the outside or by using the command telnet localhost
You can also create a message attached to the P|Pc|Pc console:\ entry in gettytab with an if=etc/issuemsg: added to the next line that will show up internally.
Ratman, you're looking for the /etc/issue file... Anything you put in there will be displayed on the login screen before you log in.
It won't display what's in that file, don't know why :(Quote:
Originally posted here by chsh
Ratman, you're looking for the /etc/issue file... Anything you put in there will be displayed on the login screen before you log in.
Then follow my post and create it.
Here's the current contents of the gettytab default line:
default:\
:cb:ce:ck:lc:fd#1000:im=\r\n%s/%m (%h) (%t)\r\n\r\n:sp#1200:\
:if=/etc/issue:
and here is /etc/issue:
*******************************************************************************
WARNING: Use of this UNIX workstation is restricted to AUTHORIZED users ONLY.
Users activities may be monitored at ALL TIMES. Unauthorized useage of this
workstation WILL BE PROSECUTED!!!!!!!!
*******************************************************************************
FreeBSD 4.3/i386
So did it work?
nope....and that's what I don't get :mad:
First thing to do is check your /etc/issue file if you're logging on physically. If you're logging on over a network check the /ect/issue.net file.Quote:
does anybody her know off hand how to make the UNIX box (Freebsd 4.3) display messages when you get a login prompt? Looked everywhere and couldn't find it
If these files are not being displayed properly, there's obviously a startup script running that is interfering with them. Goto /ect and do a grep -r "*issue*" * and see which files are refering to your /etc/issue* files. You'll probably find that there's a script running that is blocking them or overwriting them on start up.
Hope this helps :).
I cp'ed /etc/issue to /etc/issue.net and it didn't work. the grep for issue reveals no matches :mad:
What do you mean it didn't work? Jump on IRC and I will try and help you.
smirc and I tried for a long time on IRC do work this out with no success....THANKS smirc
Here's the logs on the IRC session between Ratman2 and I so you can see what we tried. All you FreeBSD gurus out there feel free to help :).Quote:
smirc and I tried for a long time on IRC do work this out with no success....THANKS smirc
<smirc> so what's going wrong exactly
<Ratman2> the message simply does not display
<Ratman2> no matter what I do
<smirc> how are you logging in?
<Ratman2> through SSH form my primary console
<Ratman2> from
<smirc> i don't think that works
<smirc> i think you have to log on from another box
<Ratman2> I am....my primary box is a Windows XP system
<smirc> are you rebooting after making the config changes?
<Ratman2> yep
<Ratman2> just logged it and no message
<Ratman2> in
<smirc> have you read this? http://andrsn.stanford.edu/FreeBSD/lognote.html
<Ratman2> yep
<Ratman2> did this this morning
<smirc> so you've done the whole google search thing?
<Ratman2> yep
<Ratman2> went nuts over there
<smirc> hehe
<smirc> what are the permissions of your /ect/issue files?
<Ratman2> 644
<smirc> and you're doing all the editing as root I assume?
<Ratman2> yep
<smirc> you've added if=/etc/issue to the default section of your /ect/gettytab file?
<Ratman2> I'll paste it in here after reboot
<smirc> how long will a reboot take?
<Ratman2> it's up now
<smirc> gotta love the speed of freebsd =)
<Ratman2> especially on a P120
<smirc> hehe
<Ratman2> default:\ :cb:ce:ck:lc:fd#1000:im=\r\n%s/%m (%h) (%t)\r\n\r\n:sp#1200:\
<Ratman2> :if=/etc/issue:
<smirc> then do a kill -HUP 128
<Ratman2> no such process
<smirc> well kill inetd
<smirc> quicker than rebooting
<Ratman2> killing
<Ratman2> now
<smirc> btw > default:\ :cb:ce:ck:lc:fd#1000:im=\r\n%s/%m (%h) (%t)\r\n\r\n:sp#1200:\ <- not sure if that last slash should be there
<Ratman2> hmm
<smirc> what happens if you get rid of it?
<Ratman2> gonna try that now
<Ratman2> rebooted minus the \
<smirc> you don't have to reboot =)
<smirc> just restart the inetd process
<Ratman2> I did....still didn't work =)'
<smirc> ummm wait a minute
<smirc> your telling the file to set the prompt as blank
<smirc> take this bit out im=\r\n%s/%m (%h) (%t)\r\n\r\n
<smirc> try that
<Ratman2> just im=?
<smirc> or try sticking your message in there
<smirc> eg im=Hello...
<smirc> yeah
<smirc> give that a go
<smirc> and remember to restart inetd
<Ratman2> didn't work =)
<smirc> what did you try?
<Ratman2> took out that stuff
<Ratman2> set im=hello
<Ratman2> ran /etc/netstart
<Ratman2> and logged out and back in
<smirc> does /ect/netstart restart the inetd process?
<Ratman2> it seems to...I see inetd and no errors show up
<smirc> try doing it with the kill -HUP inetd
<smirc> or killall -HUP inetd
<Ratman2> I've killed and restarted
<smirc> rebooted or restarted
<Ratman2> restarted inetd
<Ratman2> and still no message
<smirc> what does you login say exactly
<Ratman2> login as:
<Ratman2> which is the way it always was
<smirc> try this default:\ :cb:ce:ck:lc:fd#1000:if=/etc/issue:sp#1200:
<smirc> and have you read this? http://www.freebsddiary.org/prelogin.php
<Ratman2> the line change didn't work
<smirc> hmmm
<Ratman2> that idea on that page might
<smirc> have you got the whole thing on one line?
<smirc> because freebsd is picky about that
<smirc> what happens if you use
<smirc> default:\
<smirc> :cb:ce:ck:lc:fd#1000:im=\r\n%s/%m (%h) (%t)\r\n\r\n:sp#1200:if=/etc/issue:
<Ratman2> gonna try that next
<Ratman2> that line chage does nothing =)
<Ratman2> still just login as:
<Ratman2> ant BTW it's all on one line
<Ratman2> and
<smirc> and?
<Ratman2> still no good
<Ratman2> =)
<smirc> ok this is getting weird
<smirc> maybe there's a script running that's screwing it up
<Ratman2> no kidding
<Ratman2> I did a grep for a script
<Ratman2> no matches
<smirc> do you have a /ect/rc.d/rc.local script on your box?
<Ratman2> no I don't
<smirc> have you read this? http://www.freebsddiary.org/prelogin.php
<smirc> you could try asking the guy who wrote that
<smirc> he might know a bit more about it
<smirc> i'm not very experienced with FreeBSD
<smirc> i'd just keep trying combinations of what you've already gone through
<smirc> search web using different engines and newsgroups
<smirc> someone knows the answer
<smirc> i'm sorry i couldn't be of more help
<Ratman2> It's ok...I'll get it...you'll be getting greenies anyway
<Ratman2> =)
<Ratman2> thanks
<smirc> np
update:
The message displays if you physically login at the UNIX console but will NOT display if you login remotely
It's probably something to do with the /ect/issue.net file not being set properly in /ect/gettytab. How did you get the first part working? Let us know how it goes :).
Update 2:
Part of the problem seems to be that I use SSH for logins. SSH just displays login as: when you go to connect. I turned on Telnet temporraily and Telnet WILL display the info contained in the im variable (OS type and version, terminial type, Etc). SSHd WILL NOT even do this..NEITHER ONE will display the contents of /etc/issue and/or /etc/issue.net like I want :(
Is the -h option set for telnet in your inetd.conf? This will cause telnet not to display /etc/issue.net.
I do not believe that SSH will display /etc/issue.net properly, as the connection negotiation pretty much precludes it. It should, however, display /etc/motd upon login (well, login will display it and sshd has a hook if you want to force displaying it, etc).
Also, make sure things like hushlogin are turned off (though that's generally just a piece out of the global/skel files for your shells that ignores /etc/motd if the dot-hushlogin file exists in a user's homedir -- it's usually pretty easy to find it and take it out and kill it).
I fixed it...I just put it in /etc/motd :). I have another question which I really hate to ask but I have Crack on my box and want to use it to audit my passwords but I can't get it to install. I found the Makefile, typed in ./Makefile (as root) and keep getting Permission Denied WTF?!?!?! :mad:Quote:
Originally posted here by draziw
I do not believe that SSH will display /etc/issue.net properly, as the connection negotiation pretty much precludes it. It should, however, display /etc/motd upon login (well, login will display it and sshd has a hook if you want to force displaying it, etc).
Also, make sure things like hushlogin are turned off (though that's generally just a piece out of the global/skel files for your shells that ignores /etc/motd if the dot-hushlogin file exists in a user's homedir -- it's usually pretty easy to find it and take it out and kill it).
Ratman2: Consider using John the Ripper instead. It is the best password cracker around and it works on just about any box win or *nix. I use this to audit all my linux passwords.