06-04-2008
Basically you don't need a script for that. Create a public key with an empty pass-phrase on host A, put it into the user's ~/.ssh/authorized_keys of the host B and you will be able to do ssh or scp to B without being prompted for a password.
If you write a script where you implement this, the option "batchmode" comes in handy sometimes.
"man ssh" or Google for more info.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
Normally, we give ip address to login with ssh like ssh 172.168.0.1
And we can give login name to ssh like ssh -l root 172.10.0.21
Then the shell asks the password, we enter the password and login to the system.
While using the script file, we are not able to supply the password to... (5 Replies)
Discussion started by: pcsaji
5 Replies
2. UNIX for Advanced & Expert Users
Greetings all,
I'm in the midst of writing a login component for a series of shell scripts. What my login script does is this:
1. Prompt for username and read in username
2. Prompt for destination host and read in destination host
3. run ssh username and destination host
4. After user keys... (0 Replies)
Discussion started by: rockysfr
0 Replies
3. Shell Programming and Scripting
hi.
I need a bash script which can login to an other mashin via SSH and then run some commands and then return the result to my mashine.
I dont know where to begin, I think first I will need a ssh connection, dont know how to make it,
then , do I need a ftp connection between the 2 mashins to... (5 Replies)
Discussion started by: big_pil
5 Replies
4. Shell Programming and Scripting
I want to login to server using ssh or telnet and execute one command then exit to the shell
Please let me know how to write script for this? (1 Reply)
Discussion started by: svenkatareddy
1 Replies
5. Shell Programming and Scripting
Ok, there's been a good number of posts about this, but here goes. I want a script to log in to a system via ssh without using keys.
This will be used to log in to Cisco IOS devices.
I have tried the following, but could not get it to work:
SSH login expect shell script to supply username and... (1 Reply)
Discussion started by: mike909
1 Replies
6. Shell Programming and Scripting
I'm trying to write a login script to ssh into a cisco switch that will run some command remotely. Similar to this expect script located here:
SSH login expect shell script to supply username and password
However, that script does not work with cisco ios. Anyway know what the best way to... (1 Reply)
Discussion started by: streetfighter2
1 Replies
7. Red Hat
Hello All,
I am trying to login on server using ssh script & expect.Login to server successful but after login when i hit enter it gets hanged & when pressing CTRL +C it logs me out from the server.
Scripts are as below.
#!/bin/bash
FILE=login.txt
CONNECT=sshlogin.exp
SERVERNAME=$1... (2 Replies)
Discussion started by: ajaincv
2 Replies
8. Shell Programming and Scripting
how can i use an expect script to do a passwordless ssh login and run a script on a bunch of remote hosts? I do not want to use public key authentication as this would require me to setup the keys on the clients etc.... (2 Replies)
Discussion started by: tdubb123
2 Replies
9. Shell Programming and Scripting
Hello everyone.
I'm a Linux novice trying out a lot of bash scripting lately, as it is so very addictive.
Lately I have been setting up one of my boxes remotely and have been hardening it as much as possible. Please allow me to explain the scenario, as it does tend to become a little... (1 Reply)
Discussion started by: instro
1 Replies
10. Ubuntu
HI all
i need to connect to about 900 cisco routers and switch to do some configs changes. the issue i am having is that half the devices have one set of username and password and the other half have another username and password. From expect or bash script i can ssh into a device and make... (1 Reply)
Discussion started by: quintin
1 Replies
LEARN ABOUT LINUX
ssh-argv0
SSH-ARGV0(1) BSD General Commands Manual SSH-ARGV0(1)
NAME
ssh-argv0 -- replaces the old ssh command-name as hostname handling
SYNOPSIS
hostname | user@hostname [-l login_name] [command]
hostname | user@hostname [-afgknqstvxACNTX1246] [-b bind_address] [-c cipher_spec] [-e escape_char] [-i identity_file] [-l login_name]
[-m mac_spec] [-o option] [-p port] [-F configfile] [-L port:host:hostport] [-R port:host:hostport] [-D port] [command]
DESCRIPTION
ssh-argv0 replaces the old ssh command-name as hostname handling. If you link to this script with a hostname then executing the link is
equivalent to having executed ssh with that hostname as an argument. All other arguments are passed to ssh and will be processed normally.
OPTIONS
See ssh(1).
FILES
See ssh(1).
AUTHORS
OpenSSH is a derivative of the original and free ssh 1.2.12 release by Tatu Ylonen. Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
Theo de Raadt and Dug Song removed many bugs, re-added newer features and created OpenSSH. Markus Friedl contributed the support for SSH
protocol versions 1.5 and 2.0. Jonathan Amery wrote this ssh-argv0 script and the associated documentation.
SEE ALSO
ssh(1)
Debian Project September 7, 2001 Debian Project