Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Debian 6, .bashrc/.bash_profile/.profile questions

99 views
Skip to first unread message

Sebastian Göttschkes

unread,
Jan 25, 2012, 3:50:54 AM1/25/12
to
Hi there,

I got a testserver running debian 6 which was installed from an image my webhoster owns. This image includes a modified .bashrc, .bash_profile and .profile file for the root, stored under /root/. When I log in through ssh using the root account, my bash is nicely colored.
I created a second user, copied all three files into the home directory and changed the shell for this user to /bin/bash in /etc/passwd. Now if I login (again ssh) using the new user the shell is also nicely colored.

But here is the thing: When I connect using the new user, then use su to log in as root, the color is gone. I cannot figure out why this would happen. Maybe I don't understand which shell is used when one logs in using su.

Maybe someone can explain me a little bit was is happening there.

Thanks,
Sebastian

Richard Kettlewell

unread,
Jan 25, 2012, 4:18:43 AM1/25/12
to
Sebastian Göttschkes <sebastian....@googlemail.com> writes:
> I got a testserver running debian 6 which was installed from an image
> my webhoster owns. This image includes a modified .bashrc,
> .bash_profile and .profile file for the root, stored under
> /root/. When I log in through ssh using the root account, my bash is
> nicely colored. I created a second user, copied all three files into
> the home directory and changed the shell for this user to /bin/bash in
> /etc/passwd. Now if I login (again ssh) using the new user the shell
> is also nicely colored.
>
> But here is the thing: When I connect using the new user, then use su
> to log in as root, the color is gone. I cannot figure out why this
> would happen. Maybe I don't understand which shell is used when one
> logs in using su.

.profile or .bash_profile are only read for a login shell. See 'man
bash' for detailed discussion.

'su root' doesn't start a login shell; see 'man su' for the various
options which will change that.

--
http://www.greenend.org.uk/rjk/

Sebastian Göttschkes

unread,
Jan 25, 2012, 4:23:57 AM1/25/12
to
On Wednesday, January 25, 2012 10:18:43 AM UTC+1, Richard Kettlewell wrote:
> 'su root' doesn't start a login shell; see 'man su' for the various
> options which will change that.

Thanks for the hint. su -l solves my problem :-) Will add this to the shortcuts in my .bashrc and I should be good to go!

The Natural Philosopher

unread,
Jan 25, 2012, 5:41:02 AM1/25/12
to
I cant remember but the first thing I did in an identical situation was
to edit whatever file it was and get rid of all that eye candy :-)


By the way if you want to REALLY log in as root completely, use "su -"

su alone gives you the perms, but not the login scripts and correct root
directory.


> Thanks,
> Sebastian
0 new messages