Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

OriginalNot

macrumors member
Original poster
May 20, 2010
38
0
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.
 
Can you use public key authentication?

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

Attachments

  • ssh.jpg
    ssh.jpg
    194.1 KB · Views: 248
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
 
Can you use public key authentication?

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

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.
 
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.

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
 
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.

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.
 
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.

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.
 
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.

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. :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.