|
Home > Archive > Unix administration > March 2006 > sftp script for application promotion
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
sftp script for application promotion
|
|
| zubairom@gmail.com 2006-03-10, 5:57 pm |
| Hi,
I am new to sftp/ssh. I need to find a way to create and run an sftp
script on a Solaris host, which can read input from a paramter file,
for paths/directories/files to be migrated to another Solaris host, and
execute the transfers.
Also how can I avoid entering password interactively. Is there
something like .netrc, or I have to use public_keys. If I need to use
public_keys how may I use them?
I read some posts onsome of the groups where they talk about
public_keys ect, but I am totally new, and would appereciate if someone
can guide me in acomplishing this, given that I have minimal knowledge
expereience of ssh.
Thanks
Omer
| |
|
| zubairom@gmail.com wrote:
> I read some posts onsome of the groups where they talk about
> public_keys ect, but I am totally new, and would appereciate if someone
> can guide me in acomplishing this, given that I have minimal knowledge
> expereience of ssh.
As a simple guide...
Ssh connects from one account to another remote account. You need to do
some actions on both accounts before you can connect using keys.
Local account
On the sender account create your key (unless it exists already) using -
ssh-keygen -t dsa
It will prompt you for a passphrase. Press enter twice to have a blank
passphrase.
This produces two files ~/.ssh/id_dsa and ~/.ssh/id_dsa.pub
cat the file ~/.ssh/id_dsa.pub out and select it so it is in the clipboard.
Remote account
Now in another session window, log into the remote account. Create the
~/.ssh directory and edit/create the file ~/.ssh/authorized_keys. Paste
in the key from your clipboard. It should all be on one line.
Make sure the authorized_keys file is owned by the remote account and
set the permissions to 600.
Test connection
Now try to ssh from the sender account to the remote account
ssh remoteaccount@remotebox
If this is the first time you have connected using this method then it
will prompt you to confirm you accept this box is the correct one. You
need to type in 'yes' in full. It 'should' then log you in without a
password. Once this is working then you should also have a working sftp
connection.
Problems
Ssh is very fussy about security and permissions etc. It may refuse to
connect with a key if the remote account's home directory has incorrect
permissions or for other reasons. If it refuses to connect then you can
get more information about the problem by running sshd on the remote
server using the command
/usr/sbin/sshd -p 8081 -d
and then trying the connection again but using the command
ssh -p 8081 -v remoteaccount@remotebox
Notes: Depending on the UNIX platform, the path to sshd may be
different. This method may not work for root accounts depending on the
settings in the sshd_config file. Use another account.
JohnK
| |
| zubairom@gmail.com 2006-03-16, 5:53 pm |
| Thanks John. This helped
|
|
|
|
|