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-
. 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?
now, the problem is I dont get any prompt where I can provide the sudo password.
You don't. It's specifically designed to prevent the use of plaintext passwords as a security feature -- a less-than-subtle hint that what you're attempting is a very bad idea, because stored plaintext passwords are extremely hard to keep safe. Any attempt to shoehorn one in would be very labyrinthine.
You should instead configure sudo to allow this program (and only this program) to be run without a password by this (and only this) user, and make sure this script's options prevent it being modified (so nobody puts anything untoward in it).
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)
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)
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)
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)
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)
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)
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)
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)
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)