-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sun, Jan 12, 2003 at 07:55:11PM +0100, Michael Schwendt wrote: > On Sun, 12 Jan 2003 18:25:47 +0100, Ricardo Carrillo Cruz wrote: > > > When I login in my machine with a normal user,the normal > > user's path is correct,i mean,it hasn`t access to /sbin > > /usr/sbin neither.The problem is that when i open a console, i > > turn myself root with su,the root user inherits the same path > > that the normal user has.¿Why? I' ve tried to put the correct > > path into the .bash_profile of root,but still doesn`t work. > > Don't switch to user root, *log in* as root. Use either of > these: > > $ su --login > $ su -l > $ su - This is one possible solution, depending on what the user wants to do. However, it is often undesireable, for a variety of reasons. For example, if you do this in an xterm, and then try to run X applications, you'll generally have difficulty. You can solve that either by not using the '-' (or any equivalent) to su, or you can muck with X authentication to get around it. The latter method is a bit complicated, and probably more time-consuming than is worth putting up with. Solutions using the former (not using '-') are probably a lot easier to deal with. Another reason it's often undesireable is that root's environment tends to be substantially different from the user's normal environment, and may present them with a very different experience than their normal environment. This can happen because: - users spend much less time as root, and don't customize root's environment nearly as much as their own - there are multiple root users, and no one can agree on how root's environment should be configured The easiest way around this is to simply add /sbin and /usr/sbin to the (non-root) user's PATH. There's nothing particularly detrimental to doing so, and some commands located in those paths are occasionally useful for non-root users, as well. This is the solution that I personally favor. Another solution, if you really want to have different environments for your root and non-root user, is to create another file, say root_env, which contains shell commands and variables one wants to use when su-ing to root. After running su, you'd simply execute the following command: # . root_env Or, you could combine this with the su command like so: $ su root -c "bash --init-file /path/to/root_env" [Me memory vaguely hints that some versions of su may fail when given the -c option, if the user to which to switch is not also specified. However, me memory may be on crack... The version shipping with RH8 has no problem with this.] Note also that using "su -" is still not quite the same as logging in as root... It does not, for example, set up your X environment if you're already logged into an X session as a regular user. If the X session is properly set up to use authentication (as is generally the case on Linux systems these days), you won't be able to run apps as root this way. Other things may or may not work as expected, depending on how much environment-dependent custom applications you use in your environment. Another possible solution, depending on how you have things set up, is to ssh to localhost as root. This may take care of the X issues, if ssh is set up properly to deal with that (and allows root to log in). - -- Derek D. Martin http://www.pizzashack.org/ GPG Key ID: 0xDFBEAD02 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE+IdpSHEnASN++rQIRAilTAKCAk32KUa3tSTV/Q8picP08h6yiIgCgwNag HFIbjWY7BlSSwoXoHb/ofGY= =GFJd -----END PGP SIGNATURE----- -- Psyche-list mailing list Psyche-list@redhat.com https://listman.redhat.com/mailman/listinfo/psyche-list