Results 1 to 4 of 4

Thread: Ssh via bash

  1. #1

    Default Ssh via bash

    Good day!
    I going to create bash script for connecting remote machine using ssh.

    $SHELL -version
    GNU bash, version 4.2.10(1)-release (x86_64-suse-linux-gnu)

    I had write :

    ssh $ssh_user@$ssh_dest
    expect "?assword:*"
    send -- "$ssh_pass\r"

    but "expect" command don't performs. I found sshpass application and it works fine, but I would know is my code right & is here alternatively method for expecting ?

  2. #2
    Join Date
    May 2012
    Location
    Finland
    Posts
    2,004

    Default Re: Ssh via bash

    If you want to login to remote boxes without having to type passwords, you should use Public Key / Private Key (Public Key Cryptography / PKI)

    Here's a rough guide: https://stackoverflow.com/questions/...authentication
    .: miuku #suse @ irc.freenode.net
    :: miuku@opensuse.org

    .: h​ttps://download.opensuse.org/repositories/home:/Miuku/

  3. #3
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,631
    Blog Entries
    3

    Default Re: Ssh via bash

    Quote Originally Posted by kartashevVladimir View Post
    I going to create bash script for connecting remote machine using ssh.
    I've been doing that for years.

    However, as another responder suggested, you should use public key authentication. That's what I use. It works well.
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  4. #4
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,853
    Blog Entries
    14

    Default Re: Ssh via bash

    Quote Originally Posted by nrickert View Post
    I've been doing that for years.

    However, as another responder suggested, you should use public key authentication. That's what I use. It works well.
    Same here. Get public key authentication working first, then create a script. My ~/bin/thuis does this. Habit is to do this (even if the remote allows this) never ever as root, but connect first, then use 'su -c yast' f.e.
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •