Willie Wong schreef: > On Wed, Sep 14, 2005 at 01:25:00PM +0200, Holly Bostick wrote: > >> Charles Trois schreef: >>> >>> I thought that /etc/profile should provide the default, but I was >>> obviously wrong. Trying to mend things, I created two files >>> /root/.bash_profile and /root/.bashrc, writing just PS1 in each. >>> Now, logging in as root, the result is >>> >>> [EMAIL PROTECTED] root]$ >>> >>> which is wrong, since "$" appears in place of "#", as though my >>> syntax of PS1 were incorrect, but I don't see that it is. >> >> No, it's not incorrect, but if you wrote the exact same PS1 in the >> root entry as in the user entry, perhaps you see that there's a >> 'literal' dollar sign character at the end: >> >> PS1="[EMAIL PROTECTED] \W]\$ " >> >> which is going to be printed as itself, as you are not using any >> code to change it to the 'correct' character based on user (perhaps >> bash thinks you've escaped the closing bracket, not the following >> "$". A space between the bracket and the "\$" might solve this, but >> I've never really got /$ to work properly. It may, however, be >> because of the 'login shell issue' -- see below, but basically, if >> you're using su and not su -, your UID is not changing, so the /$ >> is not changing either). > > > No. That's wrong. > > [08:13 AM]wwong ~ $ id uid=1001(wwong) gid=0(root) > groups=0(root),6(disk),10(wheel),11(floppy),16(cron),18(audio),19(cdrom),27(video),35(games),245(locate),250(portage),408(web),440(speech),443(slocate) > [08:13 AM]wwong ~ $ su Password: sep wwong # id uid=0(root) > gid=0(root) > groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video) > sep wwong # > <snip of Willie wiping the floor with me :) > >> and get root's $PATH, since there's nothing more annoying to me >> than su-ing to root and still getting a 'file not found' error >> because whatever I'm trying to do is still not in my $PATH, because >> root's PATH was somehow not exported by su-ing. I also added an >> ENV_SUPATH variable > > > I would say something is borked on your setup. Be default, su would > look in /etc/login.def for ENV_SUPATH and ENV_PATH for default PATHs > for superusers and users respectively. Here there's also a > difference between "su" and "su -". "su" loads ENV_SUPATH from > /etc/login.def, which by default is /sbin;/bin;/usr/sbin;/usr/bin. > For "su -". because it invokes a login shell, it should grab the path > from /etc/profile, which in turn grabs it from /etc/profile.env, > which is created by env-update from the information in /etc/env.d
OK, you're right. I think that the problems that I was working around may have been based in *sudo*, not su itself, which works fine (now), as does sudo su. But when I was setting up my system with sudo (like a month and a half ago), I had all kinds of issues, because sudo did not seem to source anything (or at least not in the way I expected). For example, I had some weird borked PATH (the default ENV_SUPATH as you said above, rather than the root PATH, which I would expect from a sudo su -) , programs opened as (sudo su) root were opening with user colors and themes (though they worked with root privs), and that sort of thing. It was really bizarre, so I had a bunch of bizarre workarounds to get things to work as it seemed they should, but didn't. Maybe I borked something back in the day. It's also possible that I was having real issues, and an upgrade to shadow (hey!! *that's* the program where version 4.0.9 obsoletes ENV_SUPATH!) and/or sudo solved the issues and I just didn't notice (I did remember that I knew I was unlikely to notice the update that was going to obsolete ENV_SUPATH, and in fact, I wouldn't really note an update to shadow without making a note to myself to watch out for it. Which I should probably do). In any case, I completely forgot that sudo was involved at all, so... sorry, and just ignore me :) . I'll be busy cleaning up my bashrcs. anyway (now that everything looks to be working properly :) ). Holly -- [email protected] mailing list

