1

I made a new user on my server. The user is not logged into the bash shell on startup. To do this I can run /bin/bash --login and it works.

Where do I place this command so that it runs automatically? I tried ~/.bashlogin', ~/.profile and ~/.bashrc. When I go back to login I see the user logging in, but the shell does looks like a shell without login. E.g.,

user@computer:~/path$
$
$
$

instead of

user@computer:~/path
user@computer:~/path
user@computer:~/path

How to run the command /bin/bash --login without doing it yourself?

5
  • Bonus question: how do I add colors to this user@computer:~/path thing? Sep 7, 2014 at 21:09
  • what is the output of echo $0 when you login
    – g4ur4v
    Sep 7, 2014 at 21:13
  • I see -sh after running echo $0 for the new user. After /bin/bash --login the result is /bin/bash. For root it is -bash Sep 7, 2014 at 21:18
  • "a shell without login" That's just the prompt, not "the shell", and you can make it look any way you want. You are logged into the shell, but that shell is sh not bash. You want to change the user 's shell.
    – Leiaz
    Sep 7, 2014 at 21:38
  • 1
    @user2609980 unix.stackexchange.com/q/12335/33055 for coloring
    – Anthon
    Sep 8, 2014 at 5:02

2 Answers 2

1

If I understand your problem correctly, you created a new user, but when logging in with that user, you get some other shell, but not bash. If this is your problem, then the solution is to change the shell of that new user to /bin/bash. This can be achieved with

usermod -s /bin/bash user

3
  • You probably want to put sudo before that.
    – Anthon
    Sep 8, 2014 at 5:00
  • Yeah, of course, unless already running as root. Sep 8, 2014 at 7:32
  • Ah that is cleaner than my solution below. Thanks. Sep 8, 2014 at 16:26
0

I can run the /bin/bash --login command when I place it as the first line of the ~/.profile file. I had another line that set the path variable (i.e., PATH = "blablablabla"; export PATH) and somehow that conflicted.

Now I am logged into the shell with the new user. Thanks for the help.

Only question that remains is how to give it pretty colours.

You must log in to answer this question.

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