using SSH with my script and avoid logging in manually


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting using SSH with my script and avoid logging in manually
# 1  
Old 09-24-2009
using SSH with my script and avoid logging in manually

Hi Guys.

I have 3 variables
$HOST
$Username
$Password

I want to connect to a remote server using SFTP.

Code:
usr/bin/sftp -o Cipher=blowfish $Host

Where do I put in the options for the username and pwd??? I have tried different ways and nothing works. It keeps coming back and promting me.

a piece from my script
Code:
usr/bin/sftp -o Cipher=blowfish $HOST  <<SFTP_END
user $UserName $Password
SFTP_END

What I get in return
Code:
Connecting to mlisgcadev4...
user@host's password:

There should be a way where I can pass in all 3 values and be on my way no???
# 2  
Old 09-24-2009
well, not exactly.

sftp is made for interactive sessions. To overcome the password prompt, your target server must support key based authentication. Once you have your keys set up, you can use sftp in batch mode (-b), or at least login without a prompt.

See the sftp man page for more info.
# 3  
Old 09-24-2009
You might look for passwordless ssh. Easy search.
# 4  
Old 09-25-2009
Quote:
Originally Posted by peterro
You might look for passwordless ssh. Easy search.
hmmm...never heard of it to be honest...but worth googling it.

So my approach is what the Vendor wants us to do...is it at all doable?
# 5  
Old 09-25-2009
Quote:
Originally Posted by ramangill
So my approach is what the Vendor wants us to do...is it at all doable?
Yes, see: The UNIX and Linux Forums > Google Search > ssh+expect
# 6  
Old 09-25-2009
Quote:
Originally Posted by danmero
Ok, so it seems like a good approach for me is to use the EXPECT functionality. To do this I need TCL and Expect installed? If so, how can I verify I have this installed?

Also, just so I understand. My ksh script will call another script which is my expect script and does what I need it to do right? To invoke it I need to add to the top line # /usr/bin/expect or where ever expect is installed??
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with ssh,tar and logging

Hi, I'm successfully written a script which tar a directory and ssh's it over a remote server tar cfv - $SDIR | ssh $RHOST "cat > $DDIR/backup.$BKPEXT.tar" However, Im unable to log the activity to a file. i.e for example if I do tar cfv - $SDIR | ssh $RHOST "cat >... (1 Reply)
Discussion started by: maverick_here
1 Replies

2. Shell Programming and Scripting

How to avoid multiple ssh -o StrictHostKeychecking=no?

How do i avoid multiple ssh -o StrictHostKeychecking=no in the below script. if then echo " Please mention the server name after the script" elif ssh -o StrictHostKeychecking=no $1 "" 2> /dev/null then ver=`ssh -o StrictHostKeychecking=no $1 "cat /abc/def/version" 2> /dev/null` env=`ssh... (3 Replies)
Discussion started by: NarayanaPrakash
3 Replies

3. Shell Programming and Scripting

How to avoid ssh :Write failed: Broken pipe?

Hello, I am trying to run some code on Matlab over ssh . The code takes around 5-6 hours to complete. so after giving the command to run it , I locked my machine and then went off to sleep at night, only to discover in the morning that I get this message : ...Code running, partial results... (1 Reply)
Discussion started by: ajayram
1 Replies

4. Shell Programming and Scripting

how do i avoid system hang due to ssh in script?

I have a script that collects data from about 200 servers using 'ssh'. The problem is that, process sometime hangs at some point stopping the execution of the script. Please give me some idea how can I force the execution to jump to the next step if there arises any problem !! Thanks for replies if... (1 Reply)
Discussion started by: mdangol
1 Replies

5. UNIX for Dummies Questions & Answers

How to avoid logging with root user?

I have created a linux machine and installed some softwares on it with root user privileges . I used to login with root user credentials for doing the various task. Later i have realise that this is not the best practice to follow and there should be a new user with less privileges to be created... (1 Reply)
Discussion started by: pinga123
1 Replies

6. UNIX for Advanced & Expert Users

difference between logging into unix through f-secure ssh client and telnet

hi, what is the difference between logging into unix through f-secure ssh client and telnet is there any more security check is involved can any one explain thanks in advance (1 Reply)
Discussion started by: trichyselva
1 Replies

7. UNIX for Advanced & Expert Users

ssh not logging users

We installed ssh on our AIX 5.3 box. The issue we are facing is that we dont get the users listed when we use 'w' or 'who'. After going through google without success, checked the www.openssh.org site. The FAQ section posted the solution that - How do I go about this? Has anyone faced an issue... (2 Replies)
Discussion started by: ranj@chn
2 Replies

8. UNIX for Advanced & Expert Users

What change in freeBSD OS to allow root logging using ssh?

Hi everybody, ] I would like to ask just simpe and short question. I am using freeBSD 6.0 and Debian Sarge. From Debian console I can log as root using ssh to bsd mashine but not vice versa. When I say in bsd console su I got sorry output, it does not allow me to su to root when I am logged... (5 Replies)
Discussion started by: 100days
5 Replies

9. OS X (Apple)

SSH Logging?

Does anybody know if MacOS X (10.3.X) is capable of logging ssh access? I want to be able to see who has logged into my system via SSH, similar to the way Apache or FTP logs access (/private/var/logs/). The only thing that I am finding right now is the the initiation of a PID in the "system.log",... (0 Replies)
Discussion started by: esser
0 Replies

10. UNIX for Advanced & Expert Users

SSH and command logging

Hi all... I've completed the task of deploying SSH over my 400 servers. I don't know if i'm right or wrong, but ssh doesn't do any command-logging, does it? Is there a app i can use to log all commands passed ( besides the usual .sh_history), whith no modification possible by the user, and how... (2 Replies)
Discussion started by: penguin-friend
2 Replies
Login or Register to Ask a Question