[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

's' bit for class file



hi everybody,

    Ajay, thanks :-) the System.getProperty("user.name") checks the
effective user id and that is exactly what is required..... but there is a
small prob

no class file has execute access but can be executed
hence even setting the s-bit of the class file wont help....

only the owner of the file and root can execute getProperty()... here is
what i have done

<CODE>

public PermissionFileOperation(){ // the constructor
  System.out.println("executing cons of pfo");
  System.out.println("calling get user name");
  GetUserName();
}

 private void GetUserName(){
    System.out.println("get user name executing ....... ");
    UserName=System.getProperty("user.name");
    System.out.println(UserName);
}

</CODE>

now when owner runs ..... o/p is
---------------------------------
executing cons of pfo
calling get user name
get user name executing
project ( owner )

when root runs it
-----------------
executing cons of pfo
calling get user name
get user name executing
root

when any other user runs it
----------------------------
executing cons of pfo


what might be the reason ???? the same thing happens when
1. no class file has execute permissions
2. the class files have execute permission to everybody
3. the s-bit of the class file has been set

i even tried writing a shell script to run the class file and setting its
s-bit..... no use :-(

can anybody explain whats happening ???

thanks
- chetu