![]() |
Some application installation questions: log in as root or log in as 'user' & do 'su'
Hello:
If you have the time, and the patience, I am trying to understand the differences and/or implications of 'logging in as root to down load & install applications' vs 'logging as 'rob' (a user) to down load & install applications', if any. And, are there any further considerations based on whether you are down loading a SlackBuild vs a tarred applications from some other reputable web site on the net? Are there any nuances to be aware of? I am trying to understand if there are differences to the 'result of the install'. Thanks, |
There is no difference, just when you installing apps you need to have root privileges to copy files to system directories. The only difference will be the owner of downloaded file, which if it is dll'd as root, user rob won't be able to modify or delete it. AFAIK best solution is to download, untar, "./configure" and "make" as user and "make install" as root.
|
If you're downloading and building an application; i.e., executing a "packagename.SlackBuild," you will probably be able to do so -- "probably" means that you may have access to all the libraries and any utilities required to successfully build a package. You will not, however, be able to install it logged in a "you;" you must have root permissions to install (using su, sudo or logged in as root.
The same is true of a tar bundle you get from somewhere or other; you'll probably be able to execute configure and make but not make install unless you've root permissions. The above both assume that you're downloading into your home directory (or /tmp) and compiling there. I would be better if you have a /usr/local/src type of directory tree for stuff you add on to the system -- you'll always know where stuff is and you won't be wading through a forest in your home directory (of course you could have a src tree in your home directory instead -- up to you). Generally speaking, if you have a /usr/local/src tree, it'll be owned by root and you as a user will not be able to write in the tree. So, you'd need to use su or sudo to build and install stuff there. Six of one, half dozen of the other. Working logged in as root is not for the faint of heart. Inevitably, you'll screw up and blow a lot of stuff away that you did not mean to do. So, not such a good idea. Working with su or sudo is probably the best way to go -- you don't have to fiddle with granting permissions on directories that ought to be left alone and the chances of wiping out the system are significantly less. On thing you may want to do is edit /etc/login.defs to change the behavior of su. Used to be the default of su - was "as if logged in as;" i.e., you would get the profile of the user you "su-ed" as. Nowadays, the default behavior is that you do not get the profile unless you edit /etc/login.defs to comment-out the line Code:
# Are then any considerations about a tarball downloaded from, oh, say, SourceForge.net versus SlackBuilds.org? Well, no, probably not (but the SlackBuild will be easier to do 'cause you don't have to think about configuration options and the like). Learn to use src2pkg if you're building stuff from non-SlackBuilds.org sites. It's a good tool. RTFM. Hope this helps some. |
The other advantage to building from source via slackbuilds as opposed to installing a pre-built package from another system is that the software will usually be optimized for YOUR system rather than for someone elses, this can make a difference in the speed and stability of the app, both ways have their advantages, I have a couple of progs installed from converted RPM,s simply because of convenience or the fact that they would not build on my system, but I usually try to install either from slackbuilds or via svn/cvs/git etc and then build a package myself.
Gotta love so many options in slackware! |
Quote:
In my Slackware64 13.1 system, the above line in /etc/login.defs is not commented out and the command... Code:
su - |
Quote:
|
Well, kinda. If that line is not commented out and you're logged in as you and you execute su -, yeah, you get to be godlike but you do not get root's environment (or, for that matter, if you su - someuser, you will not get that user's profile). At least in Korn Shell (which I use) although I do not believe that has anything to do with it; but maybe...
If it is commented out (the way I prefer it) and you su - you get root's profile (or some other user). Sorry, but I come from SVR4 and Solaris and that's the way they work (thus the way I prefer) and at some point a few years back Slackware stopped working that way and I had to remember to comment out that particular line to get things to behave way I prefer. I have users that have different profiles and when I need to be that user I need to have that profile for testing and making sure that things work as they should for that user and applications used by that user. Not a big deal, just different than it used to be (in Slackware, about 10.x I think maybe). No tempest, no teapot and all is well that ends. |
A true console login session vs. `su -` (running `env` in each one and storing to a file):
Code:
# diff -u envlogin.txt envsu-.txt The same true login session vs. `su` (no dash): Code:
# diff -u envlogin.txt envsu.txt That line in login.defs does this: Code:
$ ps ax | grep [-]su |
OK, bearing in mind that the line in /etc/login.defs is commented out for all of this, I exited (which is to the console, not to a GUI login) and
Code:
log in as root What happens is that invoking su - does all the environmental setup that is done from a "raw" login; profiles are invoked (/etc/profile and its cousins plus the user's .profile and .exrc files) and a prompt is displayed. Something like this: Code:
pita-trona-/home/trona: su - Code:
cat /etc/profile.d/ksh.sh This behavior is what I want so that when I invoke su - somebody I get their complete environment without inheriting anything of the environment I started in (and when I exit there's no corpses messing with my original environment). Bottom line the behavior is different whether you comment out SU_NAME or leave it at the default; the diff above, I believe, demonstrates that pretty well. The comment in /etc/login.defs does not, I think, go quite far enough to clearly explain the effect of one way or the other. Too, things may behave differently in BASH; don't know, don't like it, don't use it. Hope this helps some. |
Quote:
Code:
login:root |
All times are GMT -5. The time now is 02:25 AM. |