08-10-2009
It isn't you script. You have to set up ssh keys on the remote server, keys that have no passphrase on them.
run ssh-keygen -t rsa
1. hit <return> when it asks for a passphrase. And again. You do not want a passphrase a all.
2. $HOME/./ssh/id_rsa.pub is the public key.
3. id_rsa.pub needs to be placed in the remote server home directory/.ssh directory, usually as the file: authorized_keys
If protections on the home directory (your side) match 755 and .ssh matches 700 (both sides)it will work.
All bets are off if you have some weird sftp PC software on the remote end. Most work okay, some do not well at all. IP Switch and Globalscape come to mind....
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hey all,
I am writing a script for sFTP using batchfile option (-B). My script is supposed to monitor a certain directory for several files and when they are found I will send them to a testing server. So using a static batchfile wouldn't be feasible, I am just wondering if anyone can show... (0 Replies)
Discussion started by: mpang_
0 Replies
2. Shell Programming and Scripting
Hi All:cool:,
i tried to automate SFTP process after passwordless authendication.
Stil i am getting error...
Can anyone help....
-------------------
sample code below
-------------------
sftp -v $mdskk@100.4.4.75 << EOF
cd /data
mget *.tar.gz
bye
EOF... (2 Replies)
Discussion started by: senthil_seera
2 Replies
3. Shell Programming and Scripting
Hi All,
I need to write a UNIX script that automates the sftp process. I should be able to do a sftp to a secure box and get a file from there. I am having a problem doing this because no matter what I do, when I run my script, I get a prompt at command line asking for a password. How could I... (34 Replies)
Discussion started by: priyamurthy2005
34 Replies
4. Shell Programming and Scripting
How to automate sftp with out using expect script?
My batch file has the password but it is not taking. Please see below.
I want to use this sftp connection in a loop for pushing new files in a directory one at a time. Hence I can not use an expect script.
bash-2.05$... (5 Replies)
Discussion started by: Tuxidow
5 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I'm using Sun Solaris OS. I have configured sftp and can exchange files in command prompt. Now when I try to automate it in ksh script, facing issue as I want to capture the status if the transfer was successful or not. So tried sftp -b and sftp -B option but its not working.
The... (3 Replies)
Discussion started by: shinny
3 Replies
6. Shell Programming and Scripting
I am trying to use a for loop in my expect cmdFile that I am calling.
I want to be able to call either one file name or a series of file names in the working directory (that I won't know the names before hand) and then pass the names to the sftp program.
Something like for i in (ls *txt)
do (0 Replies)
Discussion started by: vedder191
0 Replies
7. Shell Programming and Scripting
Greetings, guys. I'm not much of a programmer forgive me for being a noob, because of someone leaving, I was put in an IT spot where I have to figure out a few things. Being new to Linux and programming has been a challenge.
My boss has asked me to create an automated script to connect to a 3rd... (7 Replies)
Discussion started by: giovannym
7 Replies
8. UNIX for Dummies Questions & Answers
Hi, guys, I am trying to automate a sftp process using "expect" method (since the key authentication method is disabled in my company network, there is no helping it).
In order to try, I type in the command manually:
sftp @ > << EOF
>cd
>ls -l
>EOF
>Connecting to
@servername password:
... (3 Replies)
Discussion started by: warmboy610
3 Replies
9. Shell Programming and Scripting
hi,
I am trying to automate a file download process using sftp. There is some logic to download files.
1) I need to login to destination server and then go to folder.
2) find list of files and count
3) using list of files I need to eliminate three selective files and download remaining... (1 Reply)
Discussion started by: getmilo
1 Replies
10. Shell Programming and Scripting
hi guys the script is working but i need to change the file that i want to get to the latest.. i will use this as cron so i can get the latest sftp file evryday.
pls help..
set user "big_user"
set IP "XX.XX.XX"
set dir "/export/home/oracle/REF/INPUT"
spawn sftp $user@$IP
expect sftp>
... (7 Replies)
Discussion started by: JONATHAN0919
7 Replies
LEARN ABOUT OPENSOLARIS
ssh-add
ssh-add(1) User Commands ssh-add(1)
NAME
ssh-add - add RSA or DSA identities to the authentication agent
SYNOPSIS
ssh-add [-lLdDxX] [-t life] [ file ]...
DESCRIPTION
The ssh-add utility adds RSA or DSA identities to the authentication agent, ssh-agent(1). When run without arguments, it attempts to add
all of the files $HOME/.ssh/identity (RSA v1), $HOME/.ssh/id_rsa (RSA v2), and $HOME/.ssh/id_dsa (DSA v2) that exist. If more than one of
the private keys exists, an attempt to decrypt each with the same passphrase will be made before reprompting for a different passphrase.
The passphrase is read from the user's tty or by running the program defined in SSH_ASKPASS (see below).
The authentication agent must be running.
OPTIONS
The following options are supported:
-d Instead of adding the identity, this option removes the identity from the agent.
-D Deletes all identities from the agent.
-l Lists fingerprints of all identities currently represented by the agent.
-L Lists public key parameters of all identities currently represented by the agent.
-t life Sets a maximum lifetime when adding identities to an agent. The lifetime may be specified in seconds or in a time format speci-
fied in sshd(1M).
-x Locks the agent with a password.
-X Unlocks the agent.
ENVIRONMENT VARIABLES
DISPLAY If ssh-add needs a passphrase, it will read the passphrase from the current terminal if it was run from a terminal. If
SSH_ASKPASS ssh-add does not have a terminal associated with it but DISPLAY and SSH_ASKPASS are set, it will execute the program spec-
ified by SSH_ASKPASS and open an X11 window to read the passphrase. This is particularly useful when calling ssh-add from
a .Xsession or related script.
SSH_AUTH_SOCK Identifies the path of a unix-domain socket used to communicate with the agent.
EXIT STATUS
The following exit values are returned:
0 Successful completion.
1 An error occurred.
FILES
These files should not be readable by anyone but the user. Notice that ssh-add ignores a file if it is accessible by others. It is possible
to specify a passphrase when generating the key; that passphrase will be used to encrypt the private part of this file.
If these files are stored on a network file system it is assumed that either the protection provided in the file themselves or the trans-
port layer of the network file system provides sufficient protection for the site policy. If this is not the case, then it is recommended
the key files are stored on removable media or locally on the relevant hosts.
Recommended names for the DSA and RSA key files:
$HOME/.ssh/identity Contains the RSA authentication identity of the user for protocol version 1.
$HOME/.ssh/identity.pub Contains the public part of the RSA authentication identity of the user for protocol version 1.
$HOME/.ssh/id_dsa Contains the private DSA authentication identity of the user.
$HOME/.ssh/id_dsa.pub Contains the public part of the DSA authentication identity of the user.
$HOME/.ssh/id_rsa Contains the private RSA authentication identity of the user.
$HOME/.ssh/id_rsa.pub Contains the public part of the RSA authentication identity of the user.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWsshu |
+-----------------------------+-----------------------------+
|Interface Stability |Evolving |
+-----------------------------+-----------------------------+
SEE ALSO
ssh(1), ssh-agent(1), ssh-keygen(1), sshd(1M), attributes(5)
SunOS 5.11 9 Jan 2004 ssh-add(1)