5

I've created a new user in the Ubuntu 18.04.01 like this:

sudo useradd svn
sudo passwd svn
sudo mkhomedir_helper svn
sudo usermod -d /home/svn -m svn

Problem is, that if I switch to the user by su svn I don't see a standard prompt command. Instead of standard prompt:

svn@svn-server:/srv/svn/$

I see only:

$

despite the content of the file /home/svn/.bashrc. And in this "crippled" prompt I also cannot use TAB key to autocomplete paths.

If I run echo $PS1 as svn user I get empty result.

How can I fix this user?

  • 2
    Any particular reason you use useradd and not adduser? I usually use adduser username or adduser --encrypt-home username when creating a new user. – kasperd Nov 1 '18 at 15:41
  • @kasperd adduser is also typically configured to give a user bash instead of sh :) – marcelm Nov 1 '18 at 15:52
  • @kasperd the reason is simple. I didn't know the command adduser. So, thx. I'll use it in the future. – zdenek Nov 1 '18 at 16:25
  • That is the standard prompt. – Thorbjørn Ravn Andersen Nov 1 '18 at 19:03
16

Check the shell you have assigned. If you used the useradd command in Ubuntu 18, the default login shell will be /bin/sh and you will get output like you mentioned. You can change the login shell by executing the command:

sudo usermod -s /bin/bash svn
2

If you want ALL new users to use the same shell, you can set that using /etc/default/useradd. Change the SHELL setting to reflect the path to the shell binary you want to use. For example, mine looks like:

HOME=/home
SHELL=/bin/zsh
SKEL=/etc/skel
CREATE_MAIL_SPOOL=yes

Also worth noting, you can use the directory named in your SKEL setting to define what files should be copied into a new user's home directory by default. In my case, I have a .zshrc file containing zsh configurations I want for all new users.

Use these two files to set defaults for all new users.

0

You can change the shell as the new user:

$ chsh
Changing shell for svn.
New shell [/bin/sh]: /bin/bash
Password: ****
Shell changed.

There may be other mop-up work to do, such as if the account is missing parts of the expected "skeleton" content. You mention ~/.bashrc, so maybe that's not a problem here.

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.