Results 1 to 3 of 3

Thread: SSH into server - bash script

  1. #1

    Default SSH into server - bash script

    Hi,
    I want to make an .sh script to open a terminal and connect me to my remote host using SSH, but without asking me for password. How can do I type the command to put the password automatically ?

    Wich is the parameter that states the password ?

    I currently use in terminal :

    Code:
    ssh me@myhost.com -p 1888

    Code:
    usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
               [-D [bind_address:]port] [-e escape_char] [-F configfile]
               [-I pkcs11] [-i identity_file]
               [-L [bind_address:]port:host:hostport]
               [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
               [-R [bind_address:]port:host:hostport] [-S ctl_path]
               [-W host:port] [-w local_tun[:remote_tun]]
               [user@]hostname [command]
    OpenSUSE Leap 42.2 x64 KDE

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

    Default Re: SSH into server - bash script

    You would probably need an expect script, and for that you would need to install "expect" (not sure if that is the package name). It will bring in the tcl libraries.

    Most people find it easier to use public key encryption and to run ssh_agent.
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  3. #3

    Default Re: SSH into server - bash script

    Quote Originally Posted by nrickert View Post
    You would probably need an expect script, and for that you would need to install "expect" (not sure if that is the package name). It will bring in the tcl libraries.

    Most people find it easier to use public key encryption and to run ssh_agent.

    Lol, why i didn't think about that.

    I've just setup public key authentication, no passwords needed.

    If anyone is still looking for a way to "not enter" the password every time they SSH, there is a package called "sshpass" in Yast.
    OpenSUSE Leap 42.2 x64 KDE

Posting Permissions

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