# Change login prompt



## bryn1u (Jun 20, 2010)

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.


----------



## wblock@ (Jun 20, 2010)

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.


----------



## Dereckson (Jun 21, 2010)

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):


```
set prompt='%{^[]0; Login %n, ligne %h. Il est %P, bon travail sur %m :-)^G%}%B%/%b ] '
```


----------



## bryn1u (Jun 21, 2010)

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:


```
How are you ?
login: user
password:
```

u get it ?


----------



## phoenix (Jun 21, 2010)

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.


----------



## bryn1u (Jun 21, 2010)

@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?
> ...



http://www.littlewhitedog.com/content-72.html


----------



## fronclynne (Jun 21, 2010)

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:
> ...



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.]


----------



## Dereckson (Jun 21, 2010)

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.


----------



## eyebone (Jun 22, 2010)

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?


----------



## Dereckson (Jun 22, 2010)

Out of the box, without any PuTTY config, you get this result using the Banner directive:


```
login as: dereckson
________________________________________________________________________________

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

________________________________________________________________________________
Using keyboard-interactive authentication.
Password:
```


----------



## SirDice (Jun 22, 2010)

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.


----------



## h3nry (Oct 7, 2010)

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;


```
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!!)


----------



## radiant mind (Jan 20, 2015)

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.


----------

