changing prompt for user in jail

Polytropon freebsd at edvax.de
Tue Jan 1 02:08:49 UTC 2013


On Mon, 31 Dec 2012 11:25:38 -0500, Fbsd8 wrote:
> Now when I login to the jail over remote ssh to the just created user 
> account I get the % prompt, then su to root and get the
> set prompt = "# %/ >".
> I want that same prompt for all user I create in the jail.

Each user you add will have "predefined" dot files copied
into his ~ directory. Those are obtained from /usr/share/skel.
In order to make global settings available to all users,
you have to do two things:

1st: Make sure (e. g. by removing the template or changing
     its content, commenting out or deleting lines) that they
     won't receive the "predefined" dot file from the skel/
     subdirectory.

2nd: Make your change global in /etc/csh.cshrc.

If you want root to participate, make sure /root/.cshrc
does not define the following (or similar):

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

This will give you a standard UNIX prompt which will automatically
add # for root and % for non-root as prompt character, as well as
display the username, the hostname, and the working directory.

Similarly to the approach mentioned, you can "globalize" the
C shell's login and logout files: /etc/csh.login and /etc/csh.logout
vs. ~/.login and ~/.logout (from /usr/share/skel/dot.login and
/usr/share/skel/dot.logout).

If users wish to override settings, they can do that in their
home directory's dot files.



> I tried putting the set prompt = "# %/ >" statement in the jail user 
> account /home/test/.cshrc file log out and back in to no effect.

This is strange. Can you interactively change the prompt?



> Them I put the set prompt = "# %/ >" statement in the jail's
> /usr/share/skel/.cshrc and created a different user account
> using the same pw command, still no joy.

Maybe there's some relation to global files in /etc?

But note: The files in /usr/share/skel have special names!
If you want to create .cshrc, the name of the template
must be dot.cshrc (literally 'd' 'o' 't' dot cshrc).
The templates in this directory should already have this
pattern.



> Then I just added the  set prompt = "# %/ >" statement in the jail's
> /etc/csh.cshrc and created new jail user account and still no joy.
> 
> I even tried putting the set prompt = "# %/ >" statement as the last
> line in the files so it was out side of any if statements with no joy.

If the shells invoked are login shells, you can add commands
to the .login files; note that only interactive login shells
will read them.



> No matter what I do to the config of the jail files it makes no 
> difference when I use ssh to login to the jail user account.
> 
> Anyone have any idea what I any doing wrong?
> 
> Or is this just now jails work?

It should at least work on "normal level".



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


More information about the freebsd-questions mailing list