How to provide password to the prompt through Java


 
Thread Tools Search this Thread
Top Forums Programming How to provide password to the prompt through Java
Prev   Next
# 1  
Old 11-15-2010
How to provide password to the prompt through Java

Hi All,

I am using Ubuntu machine with JDK 6. I am running following command on shell-

Code:
sudo ./somecript

. Now, it prompts for sudo password and I provide the sudo password on shell and "somescript" starts running with sudo permissions.

What I want to do is, I need to execute "sudo ./somescript" fromJava code. For that I have created a jar file which executes following command
view plaincopy to clipboardprint?
Code:
Runtime.getRuntime.exec("sudo ./somescript");

now, the problem is I dont get any prompt where I can provide the sudo password.

Please guide me to provide password to sudo.


-akash
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Emergency UNIX and Linux Support

How to provide password for rsync in shell script?

Hi, i want to call the rsync in a shell script so that i can run it in background by passing the password within script itself. Can any one please let me know how can i provide the password in the shell script itself so that rsync will read the password when promted by the script. Its very... (11 Replies)
Discussion started by: Little
11 Replies

2. Shell Programming and Scripting

How to provide password?

Hi , I am trying to unzip some file in a dir using shell script ,but it prompts for password to unzip those files ,how would i provide the passoword in the script it self (1 Reply)
Discussion started by: vikatakavi
1 Replies

3. Shell Programming and Scripting

[Solved] Help with Overriding a Prompt in UNIX/Java

I am executing a shell script which contains a jar call to an external java package for which I don’t have a read access to. The external package was written in such a way that whenever we make a java –jar call to the package, it shows a prompt on the console asking if we want to continue or no... (1 Reply)
Discussion started by: Harry1302
1 Replies

4. Shell Programming and Scripting

Provide Password using to the application using the shell script

Hello, I have a requirement to shut down and start up my application on different environments (Dev, QA and Prod). I have around 24 servers. I have to login to each server manually for shutinng down the application. I wrote a shell command on each server and I am invoking those shell... (2 Replies)
Discussion started by: GDSR Raju
2 Replies

5. Programming

How do i get Java commands to be recognized in command prompt?

I would like to do some of my Java programming homework at home, and when i type things such as "javac" & "java" it does not recognize it. How do i set it up so it recognizes Java coding? (1 Reply)
Discussion started by: Anna Hussie
1 Replies

6. Programming

How do i get Java commands to be recognized in command prompt?

I would like to do some of my Java programming homework at home, and when i type things such as "javac" & "java" it does not recognize it. How do i set it up so it recognizes Java coding? (1 Reply)
Discussion started by: Anna Hussie
1 Replies

7. UNIX for Advanced & Expert Users

Changing the password prompt

Is there any way I can change the prompt which asks for the password on a UNIX system? e.g. When I login using Telnet instead of "Password" I should get "Correct Password". Thanks, Vineet (3 Replies)
Discussion started by: vineetd
3 Replies

8. OS X (Apple)

get around rsync password prompt

Hey there, I'm trying to do a very simple rsync to back up my computer to an external drive connected via usb every night, but it keeps asking for a password. I tried using the password file flag, but it looks like that is only a daemon. Does anyone have any ideas? This has eaten up a lot of my... (4 Replies)
Discussion started by: aarond
4 Replies

9. Shell Programming and Scripting

provide a user password from a script

Hi all, passwd <username> < /var/adm/passwd.txt cat /var/adm/passwd.txt abcd1234 abcd1234 when I run this from the script, it comes with: New password: It is not able to pick from the location /var/adm/passwd.txt. thanks in advance. (6 Replies)
Discussion started by: solaix14
6 Replies
Login or Register to Ask a Question
BJDWP(1)						      General Commands Manual							  BJDWP(1)

NAME
bjdwp - Command line USB Blackberry Java Debug Wire Protocol SYNOPSIS
bjdwp [-h][-p pin][-P password][-v] address port DESCRIPTION
bjdwp is a program that supports the Java Debug Wire Protocol over USB, which enables debugging of Java programs directly on your Black- berry. Support is experimental, and development is focused primarily on the BlackBerry Storm. OPTIONS
-p pin PIN of device to talk with. Only needed if you have more than one Blackberry connected at once. -P password Simplistic method to specify device password. In a real application, this would be done using a more secure prompt. -v Dump verbose protocol data during operation. -h, --help Show summary of options. ARGUMENTS
The following arguments are required, in order to provide a socket where the JDWP server will listen for connections from the debugger. address Most often 'localhost' but can be any IP or hostname on the machine running bjdwp. port Port to listen on. EXAMPLES
Start the server and the USB connection to the device: bjdwp localhost 8000 Then start your java debugger: jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=8000 AUTHOR
bjdwp was initially written for the Barry project by Nicolas VIVIEN. This manual page was written by Chris Frey. SEE ALSO
http://www.netdirect.ca/software/packages/barry September 29, 2009 BJDWP(1)