FreeBSD 9 no host name on console with regular user

How do you get the host name to show on regular users in a console? This hasn't happen before with my previous FreeBSD. All I get is a > on console with regular users.
 
I think you're just referring to your shell prompt..?

Add this to one of your user's ~/.cshrc:
Code:
set prompt = '[%B%m%b] %B%~%b%# '

Then enter:
Code:
> source ~/.cshrc

OK?
 
shells

NOTE: I normally use bash, but even in sh/tcsh/csh you shouldn't just have a >. I believe you should have a %. You get a > when you enter a \ or a ' before pressing enter, meaning the shell is expecting the rest of a string. if you have a > try typing ; and pressing enter. See if anything changes, if not check the PS1 variable by typing echo $PS1

Firstly you may want to choose a shell. Normally people go with bash. Assuming you installed the ports collection, do the following:
(AS ROOT)
[cmd=]#cd /usr/ports/shells/bash[/cmd]
[cmd=]#make install clean[/cmd]

After installing bash you need to set it to be used. Change to your preferred user and run the following
# chsh -s /usr/local/bin/bash

Check your work by checking the /etc/passwd file
#cat /etc/passwd | less
Your shell should be listed at the end.

To have the changes take affect type
#exit
and re-login.


Now to get your prompt the way you want it, set the PS1 variable. \u means user and \h means hostname (or \H for full hostname such as host.my.domain rather than just host)

Try the following:
export PS1='[\u@\h:\w ] $'
(note you may want to add the above line to your ~/.bashrc file to have this happen automatically every login, which you will need to create. try:
$ touch ~/.bashrc && echo "export PS1=\'[ \\u@\\h:\\w] $\'" >> ~/.bashrc
)

That should do it.
 
Back
Top