public class Unix extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
canForkExec()
Returns true if the program is running on a Unix/Linux system on a native Eve Vm.
|
static Process |
forkExec(String[] commands,
String[] env,
PreExec preExec)
This command only works on Unix/Linux platforms and only on a native Eve
VM.
|
static int |
getegid()
Determine the current effective group id if this is a Unix/Linux process.
|
static int |
geteuid()
Determine the current effective user if this is a Unix/Linux process.
|
static int |
getgid()
Determine the current real group id if this is a Unix/Linux process.
|
static int |
getGroupID(String name)
Get the group ID number for the specified group name.
|
static String |
getGroupName(int groupID)
Get the group name for the specified group id.
|
static int |
getuid()
Determine the current real user if this is a Unix/Linux process.
|
static int |
getUserID(String name)
Get the user ID number for the specified user name.
|
static String |
getUserName(int userID)
Get the user name for the specified user id.
|
static boolean |
isUnixProcess() |
static void |
setegid(int egid) |
static void |
seteuid(int euid) |
static void |
setgid(int rgid) |
static void |
setregid(int rgid,
int egid) |
static void |
setresgid(int rgid,
int egid,
int sgid) |
static void |
setresuid(int ruid,
int euid,
int suid) |
static void |
setreuid(int ruid,
int euid) |
static void |
setuid(int ruid) |
public static Process forkExec(String[] commands, String[] env, PreExec preExec) throws IOException
If both commands and preExec are null then a NullPointerException() is thrown.
command
- the commands to execute. The first element must contain the
path to the executable without quotes.env
- optional environment variables.preExec
- an optional object that will have its preExec() method invoked
before the exec of the specified commands.preExecData
- optional data sent to the preExec() method.IOException
- if there was an error executing the command.public static boolean isUnixProcess()
public static boolean canForkExec()
public static int getuid()
public static int geteuid()
public static int getgid()
public static int getegid()
public static int getUserID(String name)
name
- the user name.public static int getGroupID(String name)
name
- the group name.public static String getUserName(int userID)
userID
- the user id.public static String getGroupName(int groupID)
groupID
- the group id.public static void seteuid(int euid) throws IllegalAccessException, UserNotFoundException
public static void setuid(int ruid) throws IllegalAccessException, UserNotFoundException
public static void setreuid(int ruid, int euid) throws IllegalAccessException, UserNotFoundException
public static void setresuid(int ruid, int euid, int suid) throws IllegalAccessException, UserNotFoundException
public static void setegid(int egid) throws IllegalAccessException, UserNotFoundException
public static void setgid(int rgid) throws IllegalAccessException, UserNotFoundException
public static void setregid(int rgid, int egid) throws IllegalAccessException, UserNotFoundException
public static void setresgid(int rgid, int egid, int sgid) throws IllegalAccessException, UserNotFoundException