Change login prompt

Hi. I wan to change my login prompt and found something like below:
To change the text that appears at the login prompt, edit /etc/gettytab. Find the line in the default: section that starts with
:cb:ce:ck:lc
Carefully, change the text between r: to whatever text you wish to appear. Double-check that you have the right amount of s and s and save your change. For example, my login prompt looks like this:
I'm a node in cyberspace. Who the hell are you?
login:

Someone can explain me how change this prompt ?. I see nothing "r".

Greetz.
 
bryn1u said:
Hi. I wan to change my login prompt and found something like below:

Someone can explain me how change this prompt ?. I see nothing "r".

That looks outdated or garbled. The login string in 8.1 gettytab starts with "im=".

# man gettytab defines what the % codes mean. Changing the login string may not be effective or a good idea, depending on what you want to achieve.
 
If what you want is to change the prompt, when you logged in (e.g. to get something like /home/username ] instead machinename#), you need to edit your shell configuration file.

To customize bash prompt, read this dedicated FAQ.

For tcsh, you need to edit the .cshrc file in your home directory. Read this FreeBSD diary entry and the tcsh site's examples.

I personally use this prompt on tcsh for remote sessions, who update the title line with the current time and command line count (bon travail = work well, Il est = it's, ligne = line):

Code:
set prompt='%{^[]0; Login %n, ligne %h. Il est %P, bon travail sur %m :-)^G%}%B%/%b ] '
 
Dereckson i dont want to change prompt in shell. Secondly i know how to change a prompt in shell/csh. When u put ssh login@host u get:

login: user
password:

I want to make a prompt over login example:

Code:
How are you ?
login: user
password:

u get it ?
 
That's a network login, not the login prompt on the console.

Every application that allows network login will have its own custom login prompt. I don't think you're able to modify this without modifying the source for the app, and recompiling it.
 
@phoenix i got this from whitedog
To change the text that appears at the login prompt, edit /etc/gettytab. Find the line in the default: section that starts with
:cb:ce:ck:lc
Carefully, change the text between r : to whatever text you wish to appear. Double-check that you have the right amount of s and s and save your change. For example, my login prompt looks like this:
I'm a node in cyberspace. Who the hell are you?
login:
You can test your changes by going to another terminal and logging in.

http://www.littlewhitedog.com/content-72.html
 
bryn1u said:
Dereckson i dont want to change prompt in shell. Secondly i know how to change a prompt in shell/csh. When u put ssh login@host u get:

login: user
password:

I want to make a prompt over login example:

Code:
How are you ?
login: user
password:

u get it ?

For ssh, look at the [red]Banner[/red] setting in /etc/ssh/sshd_config. For console, I agree with Phoenix, you'll probably have to change the source of whatever handles console logins (getty, I guess?). [I'm mildly wrong about this, but the /etc/gettytab looks a bit complicated, wow. I guess you edit between the [red]im=\r[/red] and the [red]:sp[/red], but that's a guess.]
 
The banner sshd setting will display the login between login and password, not before login.

So, it will be okay when login from another unix machine but not from Windows through softwares like Putty when no login is specified in the config.
 
Dereckson said:
The banner sshd setting will display the login between login and password, not before login.

So, it will be okay when login from another unix machine but not from Windows through softwares like Putty when no login is specified in the config.

what? since when putty isn`t capable of printing the banner of a remote machines ssh daemon??
the banner should get printed anyway. well on the other hand the time i logged into a remote machine via putty is quite far away.
could u specify anyway how u seperate login and password in sshd differences by putty?
 
Out of the box, without any PuTTY config, you get this result using the Banner directive:

Code:
login as: dereckson
________________________________________________________________________________

  __
 /         /                         Did you know?
(___  ___ (___  ___  ___  ___  ___   The word "scherzo" means "joke" in Italian.
    )|    |   )|___)|   ) __/ |   )
 __/ |__  |  / |__  |    /__  |__/   Welcome to this FreeBSD server.

________________________________________________________________________________
Using keyboard-interactive authentication.
Password:
 
The first line "login as: " is printed by PuTTY. It has nothing to do with sshd.

The banner will be shown before authentication. The Banner directive obviously only works for ssh connections.

If you want to show a message before the login on the console create a file called /etc/issue and put the message in there.
 
hi Hi,

i I think what you want to edit is the /etc/gettytab.

look Look for the section that begins 'im:' the section is also closed by a ':'

im stands for initial message, which is what you see at the logon screen, normally something like the version of bsd/i386 and ttyXXX...

the The existing gettytab will contain \n's and \r's these probably set a newline or CR. you You may also see some other settings eg %t and %h.

%t displays the ttyname and %h the full hostname. you You don't need to have any of these if you don't want to.

to To do what you wanted originally your gettytab should contain;

Code:
default:\
       :np:[I][B]im=\r How are you? \n[/B][/I]:sp#1200:

good Good luck.....remember to make a copy of your gettytab first and try it out on a remote terminal (whilst remaining logged in somewhere else so you can revert back to the original gettytab should you break it!!)
 
Please I need help urgently in this problem.
When I try to connect with telnet to my FreeBSD 10 server it asks first for login, then it ask for the password for user@testserver. I just want to edit this message to ask for login then password, only password, and mention user@localhost just like if I connect by ftp to the same server. Thanks in advance.

Just like ftp because I have a batch working perfect on 7.3 and 7.2 versions it just change the local passwords all of its via telnet and this script stops its work...
So that my need is when I connect by telnet it asks for user and I enter it then it asks ... password .. not password for user@servertest .... so please help me if you can.
 
1) I have
Code:
% uname -srm
FreeBSD 14.0-RELEASE-p2 amd64

2) Where
Code:
% grep '^default\:\\' -A 3 /etc/gettytab
default:\
        :cb:ce:ck:lc:fd#1000:im=\r\n%s/%m (%h) (%t)\r\n\r\n:sp#1200:\
        :if=/etc/issue:
And I had no `/etc/issue` by default.

3) I did
Code:
% cat /etc/rc.local
/bin/echo > /etc/issue                 # Clear the `/etc/issue`
/bin/echo -n "        " >> /etc/issue  # 8 spaces
/bin/echo "WHITE IP ADDRESS IS:" >> /etc/issue
/bin/echo -n "        " >> /etc/issue  # 8 spaces
/usr/local/bin/curl -s ifconfig.me >> /etc/issue
/bin/echo >> /etc/issue                # This curl output has no final <0x0A>

And now I see my dynamic white IP address at the local screen every time I boot up my home server. Just before the
Code:
FreeBSD/amd64 (...) (ttyv0) # (ttyv1), (ttyv2) and so on...

login:
prompt.

This is displayed at an 8 space offset to the right, just as I wanted.

Thank you to everyone in this discussion.
 
Back
Top