(Login — Register) |
Thread Rating:
How can shell scripts check user's ID |
08-03-2010, 04:11 PM,
|
|||
|
|||
How can shell scripts check user's ID
We have several different shell scripts that we run on a daily basis. Sometimes one of the computer operators will execute the shell script as the wrong user (Root for example). This screws up the permissions and owenership on all of the files that the script just touched!
This tutorial shows you how to see who is running it. There are several ways to do that: using the Unix command id to check the user's ID, or, even more easily, using whoami When run by itself, whoami looks like this: Code: $ whoami Code: if [ $(whoami) = "joe" ] Code: if [ $(whoami) = "root" ] |
|||
08-04-2010, 08:33 AM,
|
|||
|
|||
How can shell scripts check user's ID
Awesome!!
|
|||
« Next Oldest | Next Newest »
|
Users browsing this thread: 1 Guest(s)