Visit Our UNIX and Linux User Community


how to run the script without giving the password.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to run the script without giving the password.
# 1  
Old 10-06-2009
how to run the script without giving the password.

Hi all,

I need some help in my script...

I need to login into multiple servers from one Unix box and need to login as a superuser account and then I need to perform some actions on the server. For this, i'll use for loop to provide the server names to the script, but for every login as a super user, it is asking user password. so when we are running the script, we are giving the password for every login.
For example, 10 servers are there to login.
To login into the server, it is not asking any passwords, but to login as a super user from the box, it is asking password. So for each box, i am providing the password 10 times.

I dont want to give the password for everytime login, How can I resolve this issue?

can anyone please provide an assistance for the same?

Thanks in advance.

Raghu.
# 2  
Old 10-06-2009
looks like "expect" is the tool you need...
# 3  
Old 10-06-2009
Hi Duke,

Thanks for your reply.

how can i get the "expect" tool? is it free tool?

regards,
raghu.
# 4  
Old 10-06-2009
MySQL

search on google...you'll get it... its a nice scripting mechanism to automate needs such as yours...
# 5  
Old 10-06-2009
Ok, thank you very much Duke, will search and get it
# 6  
Old 10-06-2009
depending on the distribution you are using, expect is maybe part of your system already. most linux distributions are with expect by default. solaris doesn't have expect by default. i don't know how about aix and othe flavors...
# 7  
Old 10-06-2009
you're logging into the server.. then su'ing to root? perhaps you should just setup nopasswd sudo access to the commands you need as the user you can login to with no passowrd.

Previous Thread | Next Thread
Test Your Knowledge in Computers #454
Difficulty: Medium
LibreOffice is a free and open office suite developed and maintained by IBM.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Password Less Authentication not Working After Giving Full Permission

Hello Team, Please help me to solve my Problem, By mistake, I give full permission to /(root) directory. by using the following command "chmod -R 777 /" after this, the client asks for the password to login via ssh. Before that, I an able to Login without a password. Please help me to retrieve... (5 Replies)
Discussion started by: Shubham1182
5 Replies

2. Ubuntu

Run a script at remote server without ssh password

Hello, What I want to do is to run a file on remote server by running a script at localhost but script should not ask ssh password of my remote server when script is executed. Scenario1: To copy files from server2 to data server:$ scp -r root@server2_ip:/var/www/html/*.* /var/ When I enter... (6 Replies)
Discussion started by: baris35
6 Replies

3. Shell Programming and Scripting

How to run sftp in shell script without prompting for password?

Hi, Can anyone tell me how to pass password in a shell script for sftp so that i can run it in background without user entering the password? I used a expect script but it timesout after some time and the process remains incomplete at the end. Can anyone suggest any other idea? Will the... (3 Replies)
Discussion started by: Little
3 Replies

4. UNIX for Dummies Questions & Answers

To run ksh script via autosys job without asking password for file transfer

I've K shell script. It will transfer the files from one server to other server using 'SCP' command. While running the script alone as a command line in UNIX ssh terminal its running with out asking password and files are transferred with out asking for password. But by running the script using... (6 Replies)
Discussion started by: maheshbabu
6 Replies

5. UNIX for Advanced & Expert Users

Need a exit from sftp if its ask for password and continue to run remaining part of script.

Hi I am checking status of sftp in Health check script, sftp command is used to connect the server with secure RSA key, which is successfully get connected most of the time but in some case if RSA key ask for password then I need to exit sftp command after few second and continue to run... (1 Reply)
Discussion started by: ketanraut
1 Replies

6. Shell Programming and Scripting

How to prvenent giving password run time in schell scripting?

Hi I'm copying around 20 vi files from solaris server-A to server-B using 'scp' command.I have included all 20 scp commands in one shell script. Proplem is, while executing each scp command its prompting for my NIS password of server A. Please see below How to get rid of password prompt.??? (1 Reply)
Discussion started by: buzzme
1 Replies

7. AIX

How to write a script to run without password on a batch of servers?

I need run a command such as ps -ef |grep xxx on a batch of servers, how to write a script to run it without password? don't need go in each server to check? Thanks (7 Replies)
Discussion started by: rainbow_bean
7 Replies

8. Shell Programming and Scripting

How to give password at run time in a shell script?

hi, how can i pass a password automatically when a shell script is running. i have shell script(runscript.sh) which call another shell script inside it as a different user. runscript.sh contains su - nemo -c "/bin/main_script.sh" but when i execute "runscript.sh" it try to run... (7 Replies)
Discussion started by: Little
7 Replies

9. UNIX for Dummies Questions & Answers

machine hangs for some time after giving password.

Hi I m trying to take a console of linux machine using putty. Whenever i connect to the machine and give password details to log into the machine it hangs for some time and then it allow the login. I m totally clueless why it is happening suddenly . ---------- Post updated at 01:14 AM... (1 Reply)
Discussion started by: pinga123
1 Replies

10. Red Hat

Giving access to non root users to run application

Hi All, I have created an RPM installer and installed it via ROOT user & which works fine on Red Hat. But the problem oocurs when a non root users try to run that application (from their account), it never got executed (being it has the execute permission i.e. chmod a+x somefile.sh). I want... (6 Replies)
Discussion started by: jw_amp
6 Replies

Featured Tech Videos