How to authenticate UNIX command?
As specified in KB article TS2754 <http://support.apple.com/kb/TS2754> I'd like to use this UNIX command to correct a user's computer:
dseditgroup -o edit -p -a admin -t group _lpadmin
I am trying to send this UNIX command via Remote Access 3.3 but each time it says:
Please enter user password:
Authentication failed.
I thought that the fact that I am connected to the computer via Remote Desktop using the admin user and specifying that same admin user in the "Send UNIX Command" command setup would work but it obviously doesn't.
So how do I properly send this command via Remote Desktop?
Ack - there's more:
KB article HT3511 <http://support.apple.com/kb/HT3511> is also relevant since these are networked users with mobile accounts. The problem is the same though: the script causes a prompt for authentication and I don't know how to address that in Remote Desktop.
This article adds an additional potential issue if I have to send out a UNIX command for each mobile user specifically. It's much nicer when you can send one command to the whole network.
Similar Messages
-
How to execute unix command in plsql block( urgent)
Hi All,
i want rename the unix folder to New name on update non_employee table . So, please give me idea how to use unix command here.... Please suggest me ASAP ... Its urgent
CREATE or REPLACE TRIGGER NON_EMPLOYEE_AftUpd_trg
AFTER UPDATE ON NON_EMPLOYEE
FOR EACH ROW
BEGIN
IF :new.DIST_LIVELINK_PATH <> :old.DIST_LIVELINK_PATH THEN
rename unixfolder1 to :new.dist_livelink_path.
end IF;
END;The solution will depend a lot on your Oracle version, which you forgot to mention ;)
btw shouldn't that be (in pseudocode)
rename :old.dist_livelink_path to :new.dist_livelink_pathotherwise it will always fail after the first time?
In Unix that would require the mv command. -
How to execute unix command line from cocoa?
how to execute unix command line from cocoa?
for example, if I want to call "ping" from cocoa, how should I do it? and how can I obtain the return value?
thank you.
Power G5 Quad Mac OS X (10.4.3)The following article may also help:
http://cocoadevcentral.com/articles/000025.php
Mihalis.
Dual G5 @ 2GHz Mac OS X (10.4.6) -
How do run unix command in java
hi
All unix command working fine in our java program.
but i want change user in linux by using java. it's not working.
"su root" This command onely not working.
anybody know help me
This is my ID [email protected]
This my code
<% String s = null;
try{
Process p = Runtime.getRuntime().exec("su root");
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(p.getInputStream()));
BufferedReader stdError = new BufferedReader(new
InputStreamReader(p.getErrorStream()));
out.println("Here is the standard output of the command:\n");
while ((s = stdInput.readLine()) != null)
out.println(s);
catch(Exception e) {}
%>I don't have further info to add to your first post, but think your guess seems quite reasonable. I thought of starting a new thread on the same topic, but think this (question) fits in here, too.
I have Java code (freeware, not opensoure), intended for Unix, which basically provides the graphical interface and relies on an I/O layer (C + shell scripts) to do most of the work. I have access to the C+shell scripts which are opensource. I ported it to Cygwin and want to use it under Windows (there is no Cygwin native Java VM).
My problem now boils down to " how to run commands under Unix and what differences are there with Windows". What are the variants?
I have to guess what the program is doing when I get an IOException at some point. E.g.: a call to shell script may be made in a different way as to a compiled exe in Unix?. I found a way to bypass path problems because forward slashes are also accepted and /cygdrive/c construct can be replace by c:/; shell scripts can be compiled into exes using shc and they work; if symbolic links are replaced by duplication of exe files, they work. What will happen in an instance whereby a process runs a shell script dynamically, through a pipe (the shell script is compiled in the Cygwin/win version and receives parameters) in a construct like:
pipefp = epopen(cmdbuf,"w"); /* (cmbuf is "makehdr par1 par2 ... ") (makehdr was a shell script and is now compiled exe for Cygwin/Windows) */?.
Thanks.
LT -
How to execute unix command through odi and store the result in table
I have to reconcile if data is loaded in table from csv file or not . I have to create a oracle data integrator package/interface/procedure to execute unix command to count number of rows in the csv files and store the count result in a table then i have to query the loaded table and count number of rows there and store in the table and have to compare is counts are same or not, Please assist me how to make package/interface/procedure to execute unix command and store result in oracle table.
Thanks in AdvanceUse ODI OS command tool in the ODI package.
create an interface in ODI using LKM File to Sql and the output file generated with the csv file's row count as a source and the db table(where the count needs to be stored) as a target -
How to run Unix command with Pipe ( | )?
Dear Friends,
I have to execute the below unix command through java program.
*ps -ewwo pid,args | grep -E "abc.sh|xyz.jar" | gawk '{ print $1 }' | wc -l*
My code to execute this command is,
Runtime run = Runtime.getRuntime();
File workDir = new File("/root/sat");
String psCmd = "ps -ewwo pid,args | grep -E \"abc.sh|xyz.jar \" | gawk '{ print $1 }' | wc -l";
Process process = run.exec(psCmd, null, workDir);
String line;
int i = process.waitFor() ;
if(i == 0) {
BufferedReader buf = new BufferedReader( new InputStreamReader( process.getInputStream() ) ) ;
while ( ( line = buf.readLine() ) != null )
System.out.println("Line - ["+line+"]") ;
} else {
BufferedReader stdErr = new BufferedReader(new InputStreamReader(process.getErrorStream()));
// read the output from the command
while ((line = stdErr.readLine()) != null) {
System.out.println(line);
}When i execute this command, i'm getting output as,
ERROR: Garbage option.
When i analyse the above error, i found that, the PIPE ( | ) command is not supported through java.
Could anyone please help me how to execute the above unix command (with | ) in java?
Thanks in advance,
SathishThe pipe has to be interpreted by a shell so you need
String[] psCmd =
"sh",
"-c"
"ps -ewwo pid,args | grep -E \"abc.sh|xyz.jar \" | gawk '{ print $1 }' | wc -l"
Process process = run.exec(psCmd, null, workDir);You should also read, re-read and then implement the recommendations in the 4 sections of http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html . -
Help Please: How to invoke unix command lines from java?
I have read past topics. Those are really helpful, but I still haven't got my job done. I tried the following:
String command1 = "ls -la > ls1.txt";
Runtime.getRuntime().exec(command1);
String command2 = "tcsh -c ls -la > ls2.txt";
Runtime.getRuntime().exec(command2);
String command4 = "cp keywords.txt copyversion1.txt";
Runtime.getRuntime().exec(command4);
String command5 = "tcsh -c cp keywords.txt copyversion2.txt";
Runtime.getRuntime().exec(command5);
String command6 = "tcsh -c 'cp keywords.txt copyversion3.txt'";
Runtime.getRuntime().exec(command6);
Only "command4" works. Any input will be greatly appreciated.Thank you very much Gautam. Your solution certainly works. If you don't mind, I would like to ask you (or anybody who is willing to answer) something else. I am trying to run other types of unix command lines as well. I thought that the format you gave would work for everything. But it doesn't seem so:
String command1[] = {"tcsh", "-c", "ls -la > ls1.txt "}; // this works as you suggested
Runtime.getRuntime().exec(command1);
String command12[] = {"tcsh", "-c", "lynx -dump http://www.yahoo.com > webpage.txt"}; //working fine.
Runtime.getRuntime().exec(command12);
String command10[] = {"tcsh", "-c", "ngram-count -text keywords.txt -lm LM10 &"}; //doesn't work
Runtime.getRuntime().exec(command10);
String command[] = {"tcsh", "-c", "/u/drspeech/sun4/bin/ngram-count -text keywords.txt -lm LM0 &"}; // doesn't work
Runtime.getRuntime().exec(command);
String command13[] = {"tcsh", "-c", "ngc -text keywords.txt -lm LM13"}; // doesn't work
Runtime.getRuntime().exec(command13);
String command8 = "ngram-count -text keywords.txt -lm LM8 &"; //doesn't work
Runtime.getRuntime().exec(command8);
String command9 = "/u/drspeech/sun4/bin/ngram-count -text keywords.txt -lm LM9 &"; //doesn't work
Runtime.getRuntime().exec(command9);
I tried "commandd1" and "command12". Those worked fine. No problemo. However, there's someting else I need to get done for my job; that is "command10". But it just didn't work. I thought maybe, it's because "ngram-count" is not part of the standard UNIX commands. So, I thought I might just add another alias for it in the ".cshrc" file and call it "ngc" instead. Then I tried to call the alias "ngc" instead. But it didn't work also. Then I thought, maybe, I should call it by referencing it from its original directory "/u/drspeech/sun4/bin/ngram-count". That didn't work either. I tried a couple of other combinations. None worked. I would really like to see how to solve this. -
How to execute unix command in java or jsp
have a peace day,
please send some sample code for
"execute the unix command in java or jsp"
thank you
regards
rexi execute this coding
its compiling. while running i get the error " java.io.IOException: CreateProcess: \ls-l error=2 "
import java.io.*;
import java.util.*;
public class Test
public static void main(String[] args) throws Exception
try
String[] cmd = {"/ls-l"};
Runtime.getRuntime().exec(cmd);
catch (Exception e)
System.out.println(e);
}what can i do for that
thank u -
How to execute unix command from ODI Procedure
Hi,
I am trying to execute below unix command from ODI Procedure (Command on Target tab) but I am getting the error "java.io.IOException: Cannot run program "cd": error=2, No such file or directory" but when I try to execute the same command using OdiOSCommand, it is executing successfully. I don't want to use shell script to execute this command. Is there any specific syntax am I missing to execute this command from ODI procedure?
cd /project3/tmt/;ls *.dmp > dmplist.lst
Please help me on this...
Thanks
MTHi nahlikh,
Thank you for the reply.
I used below command in Procedure but still getting the same error as "java.io.IOException: Cannot run program "OdiOSCommand": error=2, No such file or directory".
OdiOSCommand "-COMMAND=cd /project3/tmt/;ls *.dmp > dmplist.lst"
as I mentioned earlier if I use the command cd /project3/tmt/;ls *.dmp > dmplist.lst in OdiOSCommand tool it is executing successfully without any issues.
any thoughts appreciated to get a solution for this issue.
Thanks
MT -
How to run unix command from Oracle Foms 10g
OS: UNIX Solaries, Oracle Application Server 10g
To run shell script from Oracle Forms, I used the following host('/bin/bash /u01/compile.sh') and it works well
Now, I need to run unix command something like
host('mv form1.fmx FORM1.FMX') but it's not working
I tried to append the command "mv form1.fmx FORM1.FMX" to the compile.sh shell script but also it's not working although the rest lines of the shell script is running well
Edited by: slamonty on Aug 23, 2012 12:36 AMYes, Thank you so much, it works well as follow
$ /bin/mv /u01/oracle/runtime/test/form1.fmx /u01/oracle/runtime/test/FORM1.FMX Edited by: slamonty on Aug 23, 2012 9:59 AM
Edited by: slamonty on Aug 23, 2012 11:14 AM -
How to execute unix command from the Java program running on Windows
Hello,
I need to
1. Execute a unix shell script from a Java program running on the Windows.
2. I also need to capture the output of this shell script in my program.
Please suggest me how to achieve this.
Thanks in Advance.Hi...
Something is missing here
If you want to execute a shell script in windows that not posible unless you find or develop a unix shell script parser for windows.
But if you are trying the execute a unix shell script on a remote unix computer from your java program running on a windows platform you can do that by logging on to the UNIX terminal which is running on port 23 I think.
You can test this using telnet tool on windows
just type on command prompt
telnet <ip of the unix pc> <port number this case 23>
you should get the unix terminal. If that works you can do the same through java or you can directly conect to port 23 of that pc using sockets that way your program will be platform independant -
How to run UNIX command to a remote SUN machine through Java from Windows
Dear All:
I want to write one Java program which will be run on my Windows Machine.
My Java program will will login in a SUN machine remotely say telnet and run some command.
I want all those command output in my client windows PC for futher processing.
Can anyone help me doing this?
BR,
P. Guptaimport java.net.*;
import java.io.*;
import java.util.*;
public class TelnetSocketDemo {
static String list="";
static String listArr[], hostArr[];
static String host="", lhost="";
public static void main(String[] args)throws IOException
ExecuteUnixCmd obj=new ExecuteUnixCmd();
// InetAddress localMachine = InetAddress.getLocalHost();
// host=localMachine.getHostName();
list=obj.ExecuteUnixCmdMain();
int port=getPort(list,"Live");
System.out.println(port);
Socket sock = null;
String prompt=">";
String output = null;
try
// Connect to the PoleStar process.
sock = new Socket("localhost",port);
sock.setSoTimeout(60000);
// Get the I/O streams for the socket.
PrintWriter out = new PrintWriter(sock.getOutputStream(), true);
InputStream in = sock.getInputStream();
// Get to the silent console port.
// out.println("S");
// readToPrompt(in,area);
// Fetch the response to the command.
out.println("list all");
output = readToPrompt(in,prompt);
//System.out.println(output);
//out.println("quit");
//output=readToPrompt(in);
catch (Exception ex)
String msg = "unable to get Connection for PoleStar";
finally
try
// close socket
sock.close();
catch (Exception ex)
System.out.println(output);
private static String readToPrompt(InputStream in,String prompt)throws IOExcepti
on
byte[] mByte = null;
int iStrt = 0, iLen = 2000, nBytes = 0;
StringBuffer buf = new StringBuffer();
String s = null;
boolean bNotFinished = true;
do
mByte = new byte[2000];
nBytes = in.read(mByte, iStrt, iLen);
if (nBytes == -1)
break;
// lost our TCP/IP connection
// bNotFinished = false;
// Convert byte stream to a string
s = new String(mByte, 0, iStrt + nBytes);
if (prompt.equals("") == false)
if (prompt.equals(">"))
if (s.indexOf(0x04) != -1)
bNotFinished = false;
// the hub sends the prompt at the beginning and the end
else if (s.indexOf(prompt) != -1)
bNotFinished = false;
buf.append(s);
} while (bNotFinished);
return buf.toString();
public static int getPort(String list, String area)
int port;
String listArr[],hostArr[];
String lhost="";
listArr=list.split(",");
for(int i =0; i < listArr.length ; i++)
lhost=listArr;
hostArr=lhost.split("#");
if((hostArr[1].equalsIgnoreCase("connectDev20"))&&(hostArr[0].indexOf(area)!=-
1))
port=Integer.parseInt(hostArr[2]);
return port;
else
continue ;
return 0; -
Hi All,
I need to use unix command (MOVE) in ABAP code for transfering a file from one directory to another directory.
Can any one help with how to used unix commands in ABAP?
Thanks in advance.
Regards,
HemendraThe recommended approach always used to be to use transaction SM69 to define a "soft" command name to the operating system command so that it could be configured to work across Windows, Unix etc. For example:
Command name OS Type OS command Parameters for operating system command
Z_FILE_MOVE SunOS Customer mv ? ?
You can then call function module SXPG_COMMAND_EXECUTE (quite well documented) to actually perform the command passing in the appropriate number of parameters.
Jonathan -
Calling Unix command from the plsql
Hi ,
I am executing java code from the UNIX Shell script. Before executing this command i want to write plsql code to and pass the files to java command.
In the plsql code i want to select request id's using the cursor and find the .out files for each request id in the outfile path. once the file is found i want to copy that .out file to the current directory where the java command is going to execute.
Please suggest me how to use UNIX Command (in my case "cp") to copy the .out file from the outfile path to current directory after opening the cursor.If I understand you correctly, you want to generate a log of request id's from the database and send this to the operating system whereby you will execute the following:
<p>
<font face="courier">java org.apache.xalan.xslt.Process -XSL combinedfsg.xsl -OUT output.xml</font>
<p>
If that is correct, then you should be able to perform all of this w/ PL/SQL by generating the log from the database and write it to the O/S w/ UTIL_FILE. If you want to execute the java code at this point, you should be able to utilize Tom's method with the following:
<p>
<font face="courier">exec rc('java org.apache.xalan.xslt.Process -XSL combinedfsg.xsl -OUT output.xml');</font><p> -
How is a unix command executed in Java? What is the syntax?
Hi,
The best way to use a UNIX command (or another command from another operating system) is to use java.lang.Runtime class ( one of the exec method)
It will return you a Process class which represents your UNIX command being executed.
Once you finish with your process, you just have to destroy it using the destroy method of the Process class.
Hope you get the picture and good luck.
touco
Javaholic & love Duke dollars.
Maybe you are looking for
-
DVD Drive Non-Function Mac Mini 3,1 (late 2009)
Hi The DVD drive in my Mac Mini has recently become non-functional, "About this Mac" sees the drive fine, OPTIARC DVD RW AD-5670S: Model: OPTIARC DVD RW AD-5670S Revision: 2AHI Native Command Queuing:
-
Adobe Illustrator CC crashes at first launch with plugin
When I try to launch AI CC without my plugin, it doesn't crash. Then, I add .aip file in ../Program Files/Adobe/Adobe Illustrator CC 2014/Plugins/%plugin_name%/ , open illustrator, trying to close it and it crashes. But when I try to launch it with p
-
ADOBE 8.0 - ADOBE PRINT IS SET AS DEFAULT PRINTER
Hello, When I convert a Word document to pdf (File/Print select Adobe PDF) in Acrobat 8 (Pro or Standard) the next time I go to print a Word document it prints with the Adobe PDF printer and not my default printer. This was not an issue in Acrobat 7.
-
I need to know how to force a https redirect in Adobe Muse if this can't be done please tell me so I don't waste any more time... please
-
Sending attachments in Mail is Very, Very Difficult
I have sent numerous notes on this before, but it is INCREDIBLY annoying when family, friends, business associates and more continue to ask me to RE_SEND attachments because they cannot see, view, download my attachments. This was NEVER-EVER an issue