Purchase Linux CDs / DVDs / Flash Drives at OSDisc.com

Welcome to Our Community

While Linux.org has been around for a while, we recently changed management and had to purge most of the content (including users). If you signed up before April 23rd, 2017 please sign up again. Thanks!

sshpass & ssh does not cooperate?

Discussion in 'Command Line' started by postcd, Mar 14, 2017.

  1. postcd

    postcd Guest


    around 3 years back i used sshpass to input password to the ssh command and i believe it worked.
    But now it does not work.

    manual: https://linux.die.net/man/1/sshpass

    So i run the command:
    and i do not see it setup a SSH connection. When i use bad password, it reports denied access.

    command ssh h -f -N -D localhost is working very well without any problem but i wanted to show you something i noticed when i run with verbose enabled :

    (Log in to hide this advertisement)

    And SSHPASS:

    I noticed that with sshpass the last line "Entering interactive session." is not present in debug log.

    When i disabled GSSAPIAuthentication, i do not see any errors:

    tail /var/log/secure shows:
    Is there any workaround so i can run that ssh command from within bash script without need to input password myself? (i know it is security issue)

    Thank You
    #1 postcd, Mar 14, 2017
    Last edited: Mar 14, 2017
  2. JasKinasis

    JasKinasis Guest

    Now, I'm no sys-admin - but I'd say your best bet would be to set up some ssh keys.
    I used to have a couple of servers on my home network a few years ago. I used to access them over ssh using encrypted public keys, rather than using a password.

    Once the keys are set-up and working with ssh, you can disable ssh password logins on the remote server/s.
  3. rstanley

    rstanley Guest

    Set up public/private keys using ssh-keygen, then upload ONLY the PUBLIC key to the server using ssh-copy-id, and then you only need to type "ssh example", if you setup the site as "Host example" in your ~/.ssh/config file.

    Also, PLEASE, PLEASE set PermitRootLogin, on the servers, to "no" to force the user to login as a regular user. Also PLEASE, PLEASE change the default ssh port (22) on all the servers you have the authority to do, (Or take the Sys Admin for the server in question, out for a couple of good beers!) to a different (Much higher) port number! I speak from experience of hundreds if not thousands attempted logins per day on an open port 22! Of course, I also ass/u/me that your user password is NOT "password"! ;^)
    1 person likes this.
  4. postcd

    postcd Guest

    Thx for advice regarding SSH keys. So i was googling and here are commands that i tried:

    (enter to every prompt)
    I did it wrong? If so, how better i can do it please? Thx
  5. jakester

    jakester Guest

    havent you been working with ssh for years now? and it took you longer to post your 'question' than it would have taken you to just try it and find out if it worked.

    and are you seriously logging in as ROOT over a network? thats incredibly dangerous, stupid, and lazy. if you keyswap your normal account, you can omit all the flags and just type "ssh [email protected]", and get in. need root from there, type in su or use sudo for what it was written for.
  6. postcd

    postcd Guest

    i do not need to login, i need to setup reverse proxy if i understand good. if anyone knows right way or can narrow my above mentioned command, please kindly contribute. Thank You
  7. jakester

    jakester Guest

    you dont understand and if you arent clear after 3 years you should hire someone that knows what theyre doing. you could put 'ssh reverse proxy' into google if thats not too hard for you and read the first result that tells you how to do it. or you could use ssh-keys as everyone has told you and followed the howtos for that too. all that dosnt matter, since your an absolute moron if you log in as root over a network for any reasons.
  8. postcd

    postcd Guest

    Solution not found yet, i read some articles about this, but do not understand. If anyone can narrow my command it would be helpful.
  9. jakester

    jakester Guest

    not sure what you dont understand. how simple does it have to be before you get it? 3yrs now and you cant understand basic ssh commands? or any of the gazillion hits that come up in a search? or that logging in as root is stupid on a global scale? dude, i dont think anyone, anywhere is going to be able to explain it to you. tell your company to hire an admin that knows what their doing.
  10. rstanley

    rstanley Guest

    ssh is used by a user (preferably NOT root) to connect to another computer (server), NOT the "localhost", the local computer.

    As a regular user, you set up public and private keys with ssh-keygen, putting the PUBLIC key ONLY to the server using ssh-copy-id, or manually.

    Please reread my other suggestions in #3.

    If you still have problems understanding this, then you need to bring in someone locally to assist you in setting this up. Not much more advice we can give you.
    #10 rstanley, Mar 23, 2017
    Last edited: Mar 23, 2017
  11. postcd

    postcd Guest

    Thx, but my initial command (post 1 of this thread) worked without me setting up anything on the client. It just setup "proxy" on the server and then i could poiunt my web browser to this server IP and port and it worked to do proxying. So i think you did not understood what i want to do. My aim is not to set anything on the client (which is Windows PC). Need setup SSH "reverse(?)" proxy on server...
  12. rstanley

    rstanley Guest

    Sorry, but you gave me no indication of any proxy reverse or otherwise.

    Never worked with anything like this so I can't help you out.

    Please be more specific what you are attempting to do first before showing error messages or debug output.
    1 person likes this.
  13. jakester

    jakester Guest

    great so did you try putting "how to set up reverse proxy with ssh on linux" into google and pressing the enter key? or is that too complicated? logging in as root is stupid and you ignore everyone telling you that. you can do passwordless ssh from windows to linux easy with putty, so whats your problem?

Share This Page