All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Doer <robin@robind.de>
To: wolfgang127jp@ybb.ne.jp, linux-newbie@vger.kernel.org
Subject: Re: How can I login with ssh in bash shell ?
Date: Tue, 24 Jun 2003 19:59:03 +0000	[thread overview]
Message-ID: <200306241959.03361.robin@robind.de> (raw)
In-Reply-To: <20030625015518.A37B.WOLFGANG127JP@ybb.ne.jp>

Am Dienstag, 24. Juni 2003 17:05 schrieb wolfgang127jp@ybb.ne.jp:
> Hi gurus,
>
> I wanna login to my server with ssh command in bash shell.
> I found a script that login to a server with ftp command in bash shell.
>
> [...]
> ----------------------------------
>
> so I made a simple script(simple.sh) below.
> (abcdefg is the password of my_user)
> ----------------------------------
> #!/bin/sh
>
> ssh my_user@my_server <<END
> abcdefg
> echo "It works !!" > does_this_script_work.txt
> exit
> END
>
> exit 0
> ---------------------------------
>
> The result was....
> -----------------------------
> $ ./simple.sh
> Pseudo-terminal will not be allocated because stdin is not a terminal.
> my_user@my_server's password:
> -----------------------------
> Asking me the password ...
>
> Why doesn't it work ?

That will not work because, however, ssh doesn't read the passwort from stdin 
(like ftp).

But there's a way to use ssh without a password-request:

On your local machine create a key with "ssh-keygen -t rsa" (use empty 
passphrase). After that copy the public part of the key (located in 
~/.ssh/id_rsa.pub) to your remote machine under ~/.ssh/authorized_keys).
Now your script should work.

Hope it helps,
Robin
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

  reply	other threads:[~2003-06-24 19:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-24 17:05 How can I login with ssh in bash shell ? wolfgang127jp
2003-06-24 19:59 ` Robin Doer [this message]
2003-06-26 17:02   ` Stephen Samuel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200306241959.03361.robin@robind.de \
    --to=robin@robind.de \
    --cc=linux-newbie@vger.kernel.org \
    --cc=wolfgang127jp@ybb.ne.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.