On Sun, Feb 15, 2004 at 10:20:12AM -0500, [EMAIL PROTECTED] wrote: > Question # 1: > > When I type 'su' and subsequently type in my password, I am taken to the > root. However, certain programs; i.e., 'portupgrade' will not run. If I then > subsequently type 'su' I a, presented with a new prompt although no password > is requested. I can now run programs like 'portupgrade' without incident. I > am unable to find any documentation that states I should be running the 'su' > command twice. Can someone explain to me what is happening here? Is this > normal. Exactly how many levels are there? I thought that there were only > two: the log in level and root level. Is there a third level or is this some > sort of fluke.
Yes. You're right that there are only the two privilege levels -- root vs ordinary users. What you're seeing is due to a different effect. The first time you su(1) you become root, but your shell environment is not set up the way you expect. Specifically you don't have /usr/local/sbin on your $PATH, so when you type 'portupgrade' at the prompt, the shell can't find the executable. You should be able to type '/usr/local/sbin/portupgrade' and have things work as expected. The second time you type su(1), it takes effect without asking for a password, since the super user can become any other user without giving one. However, changing from root to root normally isn't usually very productive. Usually when you su(1), the shell environment is left the same except for the USER, HOME and SHELL environment variables, which are reset appropriately for the new userid. However, settings in the target login's .cshrc or .profile or .bashrc or whatever will take effect exactly as for starting up any new shell. There are some flags to su(1) to modify that behaviour: '-l' (or just '-') says simulate a full login by the target user, and '-m' does the opposite -- leaving the original environment unmodified. My guess is that the behaviour you are seeing is because either the su(1) command is aliased to add in some other options, or that you have something in root's shell initialization files which is causing the effect. On general principles, I'd recommend you to install and use sudo(8) instead of su(1) -- it has much finer grained access controls, you don't need to give out the root password in order to let people run commands with root privilege and it logs everything done with it. > Question # 2: > > Second, while typing in search terms in Google, I came across this web site > - http://andrsn.stanford.edu/FreeBSD/newuser.html > > You will notice the entry about updating the database for the 'whereis' and > 'locate' commands. I have read the manual on 'locate' and tried running the > files mentioned manually, but alias all I receive is an error message that > the command does not exist. Again, I have no idea what I am doing > incorrectly. Any assistance would be appreciated. The database update will happen automatically, overnight, in the wee small hours of Saturday morning. So long as you leave you machine running, that is. You can manually update the 'locate' database by running (as root): # /etc/periodic/weekly/310.locate and similarly for whereis: # /etc/periodic/weekly/320.whatis Those should run without errors -- if you still have problems, please feel free to e-mail here again, including the exact output of running those commands. Cheers, Matthew -- Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way PGP: http://www.infracaninophile.co.uk/pgpkey Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK
Description: PGP signature