1 |
Willie Wong schreef: |
2 |
> On Wed, Sep 14, 2005 at 01:25:00PM +0200, Holly Bostick wrote: |
3 |
> |
4 |
>> Charles Trois schreef: |
5 |
>>> |
6 |
>>> I thought that /etc/profile should provide the default, but I was |
7 |
>>> obviously wrong. Trying to mend things, I created two files |
8 |
>>> /root/.bash_profile and /root/.bashrc, writing just PS1 in each. |
9 |
>>> Now, logging in as root, the result is |
10 |
>>> |
11 |
>>> [root@sirrah root]$ |
12 |
>>> |
13 |
>>> which is wrong, since "$" appears in place of "#", as though my |
14 |
>>> syntax of PS1 were incorrect, but I don't see that it is. |
15 |
>> |
16 |
>> No, it's not incorrect, but if you wrote the exact same PS1 in the |
17 |
>> root entry as in the user entry, perhaps you see that there's a |
18 |
>> 'literal' dollar sign character at the end: |
19 |
>> |
20 |
>> PS1="[\u@\h \W]\$ " |
21 |
>> |
22 |
>> which is going to be printed as itself, as you are not using any |
23 |
>> code to change it to the 'correct' character based on user (perhaps |
24 |
>> bash thinks you've escaped the closing bracket, not the following |
25 |
>> "$". A space between the bracket and the "\$" might solve this, but |
26 |
>> I've never really got /$ to work properly. It may, however, be |
27 |
>> because of the 'login shell issue' -- see below, but basically, if |
28 |
>> you're using su and not su -, your UID is not changing, so the /$ |
29 |
>> is not changing either). |
30 |
> |
31 |
> |
32 |
> No. That's wrong. |
33 |
> |
34 |
> [08:13 AM]wwong ~ $ id uid=1001(wwong) gid=0(root) |
35 |
> 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) |
36 |
> [08:13 AM]wwong ~ $ su Password: sep wwong # id uid=0(root) |
37 |
> gid=0(root) |
38 |
> groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video) |
39 |
> sep wwong # |
40 |
> |
41 |
<snip of Willie wiping the floor with me :) > |
42 |
>> and get root's $PATH, since there's nothing more annoying to me |
43 |
>> than su-ing to root and still getting a 'file not found' error |
44 |
>> because whatever I'm trying to do is still not in my $PATH, because |
45 |
>> root's PATH was somehow not exported by su-ing. I also added an |
46 |
>> ENV_SUPATH variable |
47 |
> |
48 |
> |
49 |
> I would say something is borked on your setup. Be default, su would |
50 |
> look in /etc/login.def for ENV_SUPATH and ENV_PATH for default PATHs |
51 |
> for superusers and users respectively. Here there's also a |
52 |
> difference between "su" and "su -". "su" loads ENV_SUPATH from |
53 |
> /etc/login.def, which by default is /sbin;/bin;/usr/sbin;/usr/bin. |
54 |
> For "su -". because it invokes a login shell, it should grab the path |
55 |
> from /etc/profile, which in turn grabs it from /etc/profile.env, |
56 |
> which is created by env-update from the information in /etc/env.d |
57 |
|
58 |
OK, you're right. I think that the problems that I was working around |
59 |
may have been based in *sudo*, not su itself, which works fine (now), as |
60 |
does sudo su. But when I was setting up my system with sudo (like a |
61 |
month and a half ago), I had all kinds of issues, because sudo did not |
62 |
seem to source anything (or at least not in the way I expected). For |
63 |
example, I had some weird borked PATH (the default ENV_SUPATH as you |
64 |
said above, rather than the root PATH, which I would expect from a sudo |
65 |
su -) , programs opened as (sudo su) root were opening with user |
66 |
colors and themes (though they worked with root privs), and that sort of |
67 |
thing. It was really bizarre, so I had a bunch of bizarre workarounds to |
68 |
get things to work as it seemed they should, but didn't. |
69 |
|
70 |
Maybe I borked something back in the day. It's also possible that I was |
71 |
having real issues, and an upgrade to shadow (hey!! *that's* the program |
72 |
where version 4.0.9 obsoletes ENV_SUPATH!) and/or sudo solved the issues |
73 |
and I just didn't notice (I did remember that I knew I was unlikely to |
74 |
notice the update that was going to obsolete ENV_SUPATH, and in fact, I |
75 |
wouldn't really note an update to shadow without making a note to myself |
76 |
to watch out for it. Which I should probably do). |
77 |
|
78 |
In any case, I completely forgot that sudo was involved at all, so... |
79 |
sorry, and just ignore me :) . I'll be busy cleaning up my bashrcs. |
80 |
anyway (now that everything looks to be working properly :) ). |
81 |
|
82 |
Holly |
83 |
|
84 |
-- |
85 |
gentoo-user@g.o mailing list |