and has 0 comments
I did a service on Linux for a friend of mine, mainly a script that he was supposed to execute. He tried using it, but failed every time. I was logging in, tried it and it ran perfectly well. We scratched our heads a little until he noticed some error messages from when he executed the script, saying that a specific command could not be found.

So, this is what happens: he logs in using SSH with credentials that are not root (as it should be) then he executes su (super user) to gain root privileges. He then executes the script and the commands inside the script are not found by the system. I do the same thing, and it works.

It took a while until I realized that he gained super user privileges using just su while I was using su -. Leave it to Linux guys to have a single minus sign as an important command line parameter :) su - executes the complete shell environment for the root user and changes the PATH variable and the home directory (to root). su gives you root privileges, su - makes you root.

Comments

Be the first to post a comment

Post a comment