10.0 set prompt for new users has problems

Polytropon freebsd at edvax.de
Thu Apr 24 18:02:10 UTC 2014

On Thu, 24 Apr 2014 11:09:48 -0400, Fbsd8 wrote:
> 10.0 host and using pw command to adduser.
> pw adduser test -c Test-user -m -g wheel -w yes
> original /etc/csh.cshrc and /usr/share/skel/dot.cshrc files
> When I log into user test the prompt is a single dollar sign.

This is not the default prompt for the C shell. It
looks like you're running sh or bash. Can you check?

	$ echo $SHELL

to see what login shell has been defined. Maybe the pw
command did not set csh as the login shell, and you're
left with sh as default.

> Issuing the ll command i see .cshrc*
> Why does this file end with an *?

This is because the file has the executable attribute (+x)
set. There are other "signifiers" for files and directories.
Try the following

	% setenv LSCOLORS 'ExGxdxdxCxDxDxBxBxegeg'
	% ls -laFG .cshrc

The colors will also reflect the "executable" attribute.

Note that this file does _not_ have to be executable, so
check /usr/share/skel if the file has _accidentally_ been
chmod'ed with +x. When copying the content of the skel/
directory (or subtree), attributes will be kept.

> I can edit the as .cshrc* or .cshrc and replace the existing  set prompt 
> statement with set prompt = "# %/ >"  then save the file, exit and login 
> again. The prompt is still a dollar sign.

The user's .cshrc file should override any other settings
dome at "higher levels" such as /etc/csh.cshrc. Try the

	set promptchars = "%#"
	set prompt = "%n@%m:%~%# "

This should give you the default C shell prompt. If _this_
works, start modifying it according to your preference.
You can replace %n with %N on newer C shell versions.

> If I issue set prompt = "# %/ >" command from the test user command line
> the prompt still doe's not change.

Very strange - I have tested this here, it changes the prompt.

	poly at r56:~% set prompt = "# %/ >"
	# /home/poly >_

However, when I try this in sh:

	poly at r56:~% sh
	$ set prompt = "# %/ >"
	$ _

This encourages me to think that my initial assumption of
you running the "wrong" shell is correct. :-)

> I can edit the /usr/share/skel/dot.cshrc replacing the existing set 
> prompt with the new one, deluser test, adduser test, and still get 
> dollar sign for the prompt even though I see the wanted prompt statement 
> in user test home directory .cshrc* file.

Add -s csh to your pw adduser command.

> Another problem is the alias commands la and lf don't work but the ll 
> alias does work.

Try "which ls ll" to find out what is actually being executed.

Example from my (customized) C shell:

	% which ls ll
	ls:      aliased to ls -FG -D "%Y-%m-%d %H:%M:%S"
	ll:      aliased to ls -laFG -D "%Y-%m-%d %H:%M:%S"

Note that I've modified /etc/csh.cshrc to make global settings
for all users (prompt, aliases, $LSCOLORS) and almost emptied
the /usr/share/skel/dot.cshrc template. Users here are free to
add their own settings and replace default things, but most
of them are happy. The unhappy ones use bash anyway. :-)

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list