I'm spinning up a bunch of identical servers but I don't have my ops deployment set up yet. Well, I already made a mistake in initializing the first server, namely, useradd steam not adduser steam.

first server has no colors

I tried to repair the user using mkhomedir_helper steam, as well as switching the user directory to /home/steam1 and back to /home/steam. I didn't make the mistake on my second server, and that one has colors on it.

second server has no colors

I've tried to copy the .bashrc from both the root account and the /etc/skel

rm /home/steam/.bashrc;sudo cp /root/.bashrc /home/steam/.bashrc
rm /home/steam/.bashrc rm /home/steam/.profile /home/steam/.bash_logout;sudo cp /etc/skel/.* /home/steam

After each of these commands, I disconnected and reconnected to my box, but I still had no colors. I also tried to set force_color_prompt=yes, but that did not fix the colors issue either.

Any ideas on how I can fix this user account to have colors? Any new user I create on the box and root also have colors.

  • Maybe the difference is that useradd sets the login shell to /bin/sh rather than /bin/bash so it's not reading ~/.bashrc at all? Check the value of SHELL in /etc/default/useradd – steeldriver Jul 21 '18 at 21:44
  • I did cat /etc/passwd/ and it's set to steam:x:1000:1000:steam,,,:/home/steam:/bin/bash in both. – PatPeter Jul 21 '18 at 21:46
  • The default SHELL is definitely /bin/sh and I had to change it from sh to bash after user creation. – PatPeter Jul 21 '18 at 21:47
  • OK - did you copy only the .bashrc, or the .profile as well? the latter will be the one that affects login shells (and in fact sources .bashrc by default). In fact if you want to do what adduser does, then copy ALL the files from /etc/skel – steeldriver Jul 21 '18 at 22:11
  • At first I only copied .bashrc, but I updated my question with my attempt at copying .profile and .bash_logout as well. – PatPeter Jul 21 '18 at 22:40

I used one of my image scripts to add my custom environment variables to .bash_profile (as I'm used to doing on Red Hat distros), not knowing that Ubuntu uses .profile instead, and that by defining .bash_profile I was overriding .profile.

I moved my variables into .profile and deleted .bash_profile, and this was fixed.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.