SSH Automatic Login

Discussion in 'Mac Apps and Mac App Store' started by OriginalNot, Sep 5, 2010.

  1. OriginalNot macrumors member

    Joined:
    May 20, 2010
    #1
    First I'm not sure if this is the correct place to post this, but it seemed the most fitting.

    I recently moved into University Residence. We do have internet services, but it requires an ssh login through terminal.

    So something like "ssh username@10.0.0.1" then enter then put in your password. I was trying to automate this process so I could simply click on something and my internet works. It gets tiresome having to do this every time I want internet.

    So my current progress involves me creating a "Internet.command" file with the lines:

    ssh username@10.0.0.1
    sleep 2
    password

    Unfortunately this does not seem to work out. It seems as though the password is not entered. If I simply leave out the last two lines I can get to the point I just have to enter my password and hit enter.

    How would I go about doing this all automatically? I tried the recording functions through automator, but this also failed at being all inclusive. Required me to click on terminal at just the right moments. If anyone could hlep me with this it would be greatly appreciated.
     
  2. raxafarian macrumors regular

    Joined:
    Jun 8, 2007
    #2
    Can you use public key authentication?

    here's the setup (sorry... have it saved as a screen capture)
     

    Attached Files:

    • ssh.jpg
      ssh.jpg
      File size:
      194.1 KB
      Views:
      179
  3. raxafarian macrumors regular

    Joined:
    Jun 8, 2007
    #3
    another option may be to make an alias in your .bash_profile

    I have mine set so I type one letter and it connects. I'd have to dig for other options but this is mine:

    alias s='ssh -p <mynonstandard_port> root@<myserver>.com'


    so I start terminal and type 's' and it connects. I'm using keys but you should be able to modify for password
     
  4. OriginalNot thread starter macrumors member

    Joined:
    May 20, 2010
    #4
    Now I don't think this will work out as I do not have access to the server. All I can do is stuff on my end, but maybe I'm not understanding that correctly? If you could confirm for me that would be great.


    @raxafarian

    Will try something along those lines later today, thanks.


    If anyone has any other ideas that can be implemented solely from my system that would be a great help.
     
  5. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #5
    Confirmed. You would need to upload one of the key pair to the server, so if you can't do that this won't work.

    The only option that I know of off hand is to remove the password requirement, which can be done via the sudoers file, but this does compromise security some. If you want to look into this here are some links.

    http://www.sudo.ws/sudo/sudoers.man.html
    http://forums.debian.net/viewtopic.php?p=258483
    https://help.ubuntu.com/community/Sudoers

    I believe it would be something like,

    Code:
    username	ALL=NOPASSWD: /usr/bin/ssh
     
  6. LPZ macrumors 65816

    Joined:
    Jul 11, 2006
    #6
    You should contact the server's administrators about whether they will accept your public key. It's in their interest to do so, as it makes the entire system more secure.

    All they need to do is place your key in the appropriate place on the server, and enable keypair authentication.
     
  7. OriginalNot thread starter macrumors member

    Joined:
    May 20, 2010
    #7
    The problem with this is, we have aproximately 2000 people using this one network. To have to do that for every person would become incredibly tiresome for them.
     
  8. mikepro macrumors 6502

    Joined:
    Sep 3, 2010
    #8
  9. LPZ macrumors 65816

    Joined:
    Jul 11, 2006
    #9
    Why not ask, instead of guessing what might be "incredibly tiresome" for someone else? It takes maybe 10 seconds, and I assume the admins are salaried employees. :)
     

Share This Page