The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: checking uid
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #7 (permalink)  
Old 07-19-2007
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,928
Quote:
Originally Posted by filthymonk View Post
[...]
1. how to get the uid of the user ?


Code:
$ ps -p $$
   PID TTY      TIME CMD
 10387 pts/4    0:00 bash
$ id
uid=0(root) gid=1(other)
$ echo $UID
0
$ [ "$UID" -eq 0 ]||{ echo 'Go away!';exit 1;}
$ su - oracle
$  [ "$UID" -eq 0 ]||{ echo 'Go away!';exit 1;}
Go away!
logout