Showing posts with label ssh. Show all posts
Showing posts with label ssh. Show all posts

Thursday, January 3, 2013

Using Applescript to lauch several terminal tabs with ssh

This is an applescript that will launch your terminal and go ahead and get you logged into several ssh sessions in tabs. I wrote this...or rather cannabalized somebody else's script, when I was a sys admin and programmer, I needed to be sshed into several machines at the beginning of work. I thought that if I used scripts like this I would end up saving time in the long run.

This actually turned out not to be true, but through no fault of my own. It turned out that the e-commerce book store that I was working for was getting over ninety percent of there sells from a single book, that relied on a single link referral. And they pulled the link referral because the place that I worked for, was constantly late delivering the book. Never trust a company with Christian in their name.

You will need to change "root" to be your user and the domain names to be your domain names. If you have ssh keys set up, you should be good to go. Otherwise you will have to manually type or paste your password in.

Occasionally a ball-peen hammer hits me in the head and I forget how to set up ssh keys, if this happened to you, you can use this link to remind yourself. HowTo Ssh Keys

set user to "root"
set theHost to "mechanicalpinata.com"

activate application "Terminal"

tell application "System Events"
 tell process "Terminal"
  keystroke "t" using command down
 end tell
end tell

delay 1 -- it seems we need this

tell application "Terminal"
 do script "ssh " & user & "@" & theHost in the last tab of window 1
end tell

set user to "root"
set theHost to "YourOtherDomainNameOrIP.com"

activate application "Terminal"

tell application "System Events"
 tell process "Terminal"
  keystroke "t" using command down
 end tell
end tell

delay 1 -- it seems we need this

tell application "Terminal"
 do script "ssh " & user & "@" & theHost in the last tab of window 1
end tell

Thursday, January 13, 2011

Simple Stupid Linux Tricks ssh port forwarding

At work I'm firewalled in, and I'm on a linux server...however they allow traffic over port 22. So it's really easy to get to meebo. You can do this with most sites, however if they require more than one port you'll need a more complex solution.

I fire up cygwin and type this in.(You can use any ssh client though)


ssh -L 8888:meebo.com:80 root@wereboobs.com -N

ssh creates a tunnel from me to wereboobs, which the proxy doesn't care about to meebo which the proxy does(ironic, no?). So now if I type localhost:8888 into my browser I can get to meebo without going through the web proxy. Bonus...the web traffic from meebo is encrypted until it reaches wereboobs.

Monday, December 15, 2008

How the hell am I even sshed in

I am connected to my dedi. I can't hit google, and I can't traceroute anywhere. How the fuck am I even sshed in?

Saturday, December 13, 2008

stupid nix trix: simple stupid ssh piping

I am going to start a feature called stupid nix trix, that will be one liner helpful commands that you can do on *nix ( unix, linux, mac ) machines.

So let's say you have a file on your home nix machine and you need it on your server, well if ssh is enabled on that server you don't need to break open filezilla just to sftp that file across, you can do it in one line:

Hypothetical:
cat /orignalDir/filename | ssh usernameforserver@server.tld "cat > /destinationDir/filename"

Real World:
cat $HOME/.ssh/id_rsa.pub | ssh root@irc.9unk0r.com "cat > /tmp/id_rsa.pub"

Friday, March 14, 2008

How to put ssh on your mac

All you need to do is go to system preferences then choose sharing. Hit the services tab. Then choose remote access and then enable. SSH is now enabled. If you want to access it from outside your network don't forget to use some port forwarding fu on your router.