Hi,
Can anyone tell me how to modify this so that it won’t prompt me for a password:
sftp $HOST <<END_SCRIPT
quote PASS $PASSWD
lcd $REMOTE_PATH
put $FILE1
put $FILE2
quit
END_SCRIPT
Hi,
Can anyone tell me how to modify this so that it won’t prompt me for a password:
sftp $HOST <<END_SCRIPT
quote PASS $PASSWD
lcd $REMOTE_PATH
put $FILE1
put $FILE2
quit
END_SCRIPT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
‘man sftp’
<quote>
sftp is an interactive file transfer program, similar to ftp(1), which
performs all operations over an encrypted ssh(1) transport. It may also
use many features of ssh, such as public key authentication and compression
</quote>
SSH-based things use ‘public key’ authentication to get past password
prompts. This typically involves using commands like ‘ssh-keygen’,
ssh-add, and ssh-agent. Once you have the authentication parts setup
you can use sftp, scp, or ssh without being prompted for a password in
the first place. There is a lot of information online and in man pages
about these commands so start there and ask questions as you have them.
Good luck.
eeijlar wrote:
> Hi,
>
> Can anyone tell me how to modify this so that it won’t prompt me for a
> password:
>
>
> Code:
> --------------------
> sftp $HOST <<END_SCRIPT
> quote PASS $PASSWD
> lcd $REMOTE_PATH
> put $FILE1
> put $FILE2
> quit
> END_SCRIPT
> --------------------
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFI92bx3s42bA80+9kRApDiAJ44v+PqqVgCx/hWHW3T/Veq7T0d1wCeMKQ3
OyyvKbM8M2FCqX5Qt5uQSgk=
=XpgJ
-----END PGP SIGNATURE-----
I have done some rooting around and it looks like you have to generate a key to stop the password from appearing, steps are as follows:
**
On the remote machine**
Log in as the remote user and then in their /home directory type:
ssh-keygen -t rsa
Hit enter twice at the pass phrase prompt…
then do:
cd .ssh
On the Local Machine
cd .ssh
Secure copy…
[Replace remote-host with your own host name below]
scp remote-host:.ssh/id_rsa.pub remote-host.key
cat remote-host.key >> authorized_keys
I still get prompted though even after doing this…
Basically, what I’m trying to do is take the output of a script on one machine (a couple of files) and then securely copy them to another machine… I was trying sftp to do this… but any ideas are welcome…
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
You’re well on your way, but I think you’re doing it backwards. I’ll
refer to the ‘client’ and the ‘server’ with the client being the SSH
client side and the server being the SSH server side. In your original
post the command ‘sftp’ is being run on the client, and $HOST is holding
the value to your server. So, on your client run the 'ssh-keygen -t rsa
ssh-add
Now try your sftp or ssh or scp command. Tada. If the ‘ssh-copy-id’
command isn’t available or doesn’t work simply copy the contents of your
public key file and append it to the remote server’s user’s
authorized_keys file like you were already doing and you should be fine.
BE SURE you NEVER lose or give access to your PRIVATE key file (the one
NOT ending in .pub) because anybody who has that can authenticate the
same way you do without a password.
Good luck.
eeijlar wrote:
> Basically, what I’m trying to do is take the output of a script on one
> machine (a couple of files) and then securely copy them to another
> machine… I was trying sftp to do this… but any ideas are welcome…
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFI93wJ3s42bA80+9kRAimkAJ0aueQQaBCXyo/zKlJVtNCidBnAugCfW0VL
tJKhMOjujrORaRi8Ybrv1fY=
=cOwf
-----END PGP SIGNATURE-----
That worked like a charm… thank you so much!!
I was also running the script as root and generating the key as a normal user so that didn’t help either…
/jlar
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Glad to hear it. Thanks for posting back.
Good luck.
eeijlar wrote:
> That worked like a charm… thank you so much!!
>
> I was also running the script as root and generating the key as a
> normal user so that didn’t help either…
>
> /jlar
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFI95Ro3s42bA80+9kRAlc+AJ0a6hbUALZFbZ9L+gh+IgvGQvVEQACfbyih
4gjWrXmkGl1CF00oGS/HdD4=
=ubJf
-----END PGP SIGNATURE-----
Unfortunately, this worked on my home machine but when I changed to the actual client server I want to get it working on it’s not working…
I get this when I try and do the ssh-copy-id
/usr/bin/ssh-copy-id: ERROR: No identities found
It’s a bit weird because when I checked in the .ssh on the client machine it didn’t have any authorised keys file. All it has is:
id_rsa id_rsa.pub
Any ideas??
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Create the file yourself. If nothing else use ‘scp’ to copy of your own
id_rsa.pub into the receiving side’s authorized_keys file:
scp ./.ssh/id_rsa.pub username@remotebox:.ssh/authorized_keys
Good luck.
eeijlar wrote:
> Unfortunately, this worked on my home machine but when I changed to the
> actual client server I want to get it working on it’s not working…
>
> I get this when I try and do the ssh-copy-id
>
> Code:
> --------------------
> /usr/bin/ssh-copy-id: ERROR: No identities found
> --------------------
>
>
> It’s a bit weird because when I checked in the .ssh on the client
> machine it didn’t have any authorised keys file. All it has is:
>
>
> Code:
> --------------------
> id_rsa id_rsa.pub
> --------------------
>
>
> Any ideas??
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFI+nrt3s42bA80+9kRAgBYAJ0T3a54u1d4E2jXcHBQyPqTWkzFQwCfW/du
bkgyq/M+vZ5VKiNfcNLRC/M=
=ldUn
-----END PGP SIGNATURE-----
That worked… again… thank you so, so much… I have been trying to get this working for ages.
/jlar
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
No problem. Glad I could help, and thank-you for posting back the results.
Good luck.
eeijlar wrote:
> That worked… again… thank you so, so much… I have been trying to
> get this working for ages.
>
> /jlar
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFI+5mE3s42bA80+9kRAuPLAJsHx1gUdrUv8OT6JzkJWooqZNFVmgCeKSx6
Uieq+4dBDB9m5s3qvuPPEow=
=zH6i
-----END PGP SIGNATURE-----