By default, when creating an ubuntu 18.04 EC2 instance, and logging in with ssh, my bash prefix shows my username and ip address like so: ubuntu-$. After deleting the default ubuntu user in my instance, and creating a new user, when logging in with ssh the only prefix I get is $ in my terminal. This makes things very difficult when loggin into multiple servers at the same time, as one can easily confuse one servers terminal from the other without that prefix.

How can I get my ssh login to show the original prefix that ubuntu starts out with on EC2?

  • This is down to the login shell that you set for the user, and how the shell defines its prompt string (e.g. setting PS1 inside the user's ~/.bashrc) – steeldriver Apr 24 '20 at 13:44
  • How exactly do I set PS1 in ~/.bashrc? – DanRan Apr 24 '20 at 13:50
  • How exactly did you create the new user? usually, you would arrange for a default set of "skeleton" configuration files to be copied from the /etc/skel directory - including a default .bashrc file with a suitable PS1 definition. – steeldriver Apr 24 '20 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.