0

I am using SUSE Linux Enterprise Server 11 SP3 and I am facing an issue related with a user using ksh.

I have created a user as follows:

testenv:$2y$10$vjUVUejLhMGoTn2CHPqmU.kFOR8qex9STqNqiaqVZ0H8XR4MH1dEi:50004:121:Test Environment:/home/testenv:/usr/bin/ksh

Certain lines were appended to /etc/profile file in order to customize the shell prompt, which are as follows:

Cy="${Esc}[36m"  # start cyan
Re="${Esc}[31m"  # start red
Yl="${Esc}[33m"  # start bolding in yellow
Ba="${Esc}[0m"   # end everything

PS1="${Cy}`hostname` $Re$USER${Yl} ";PS1=$PS1'[${PWD##*/}]';PS1=$PS1'$Ba > '

No changes are made to /etc/ksh.kshrc.

When I log into the server as that particular user using su - testenv, I get following prompt:

h:w>

But, when I execute source /etc/profile after logging in, I get the expected results. I have also observed that, same configurations are working fine on SLES 10. What might be the issue here?

5
  • I can confirm that it works as expected on Debian. I'm guessing there's probably another file in the user's $HOME which is setting PS1. Look in ~/.profile. Also check what ENV is set to when logging in as that user.
    – terdon
    Apr 29, 2015 at 13:01
  • This looks like a setting for bash (PS1='\h:\w>' would display the host name and working directory). What is the entire content of /etc/profile? What dot files does the user have (ls -lA ~)? Apr 29, 2015 at 22:25
  • @terdon ENV is set to /home/testenv/.kshrc, which is an empty file. And there is no .profile file. Apr 30, 2015 at 5:02
  • @Gilles - Shall I paste the contents of /etc/profile here? Following are the dot files in user's home directory - .bash_history, .cpan, .fonts.cache-2, .idlerc, .kshrc_history,.lesshst, .local, .mysql_history, .rnd, .sh_history, .ssh , .viminfo. Apr 30, 2015 at 5:08
  • @MandarShinde Please edit your question to add this information. Apr 30, 2015 at 7:17

1 Answer 1

0

Perhaps the prompt global setting defined in /etc/profile is overwritten by the prompt user setting in ~/.profile ?

2
  • No such file ~/.profile found. Did you mean ~/.bash_profile? I have checked with ~/.bash_profile and ~/.bashrc, but no such files were there. Apr 29, 2015 at 11:01
  • 1
    Ksh uses ~/.profile (if it exists) for user custom settings.
    – dr_
    Apr 29, 2015 at 11:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .