If you use the Terminal for any amount of work, sooner or later you will probably come across the need to use SSH. SSH is a transfer protocol used to send data securely over the internet. It stands for Secure Shell. SSH has the ability to use keys, which will allow one computer to access another computer using really long encrypted password. Keys are considered more secure than passwords because they are much longer in length and can not be easily broken via brute force methods, like most passwords can.
Mac OS X is built on UNIX, and has SSH installed on all versions of Mac OS X by default. No extra software is necessary to use SSH on Mac OS X. But to generate an SSH key on Mac OS X takes a few steps.
Step 1: Open Terminal
First, open the Terminal app on your computer. The Terminal app resides in /Applications/Utilities. The easiest way to launch it is to open Spotlight with Command-Spacebar, and then start typing Terminal. You should see the app as the top selection. Click enter to launch it.
The Terminal should open using your home directory as the default directory, but in case it doesn’t, do this:
Step 2: Check for existing keys
Now, inside your home directory, let’s see if you have any SSH keys already created:
ls -al ~/.ssh
If this is a brand new installation of Mac OS X, the .ssh directory might not even exist. (Pro Tip: Directories that have a period in front of them are hidden by default, meaning, you won’t see them listed in the Finder.)
If you have any keys already created, most likely they would be files listed with a “.pub” extension. Some default key file names are:
If you don’t have any keys already created, go to the next step to create one.
Step 3: Generate a new SSH key
In the terminal, enter this command:
ssh-keygen -t rsa -C "email@example.com"
Substitute your email address for the one listed above.
Hit enter, and you should see the following message returned:
# Generating public/private rsa key pair.
# Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
Press enter to create a key using the default settings.
Next, you will be asked to enter a passphrase. A passphrase is essentially a password that will be used every time the key itself is used. It’s another layer of security. You can hit enter and bypass using a passphrase, but you are effectively limiting how secure your connection will be. Keys can be stolen, and without a passphrase, someone could use your keys without any consequence. If you forgo using the passphrase, be warned.
Enter passphrase (empty for no passphrase): [Type a passphrase] # Enter same passphrase again: [Type passphrase again]
Once you enter your passphrase (or click enter to bypass entering a passphrase) you should see a confirmation that your key has been created, which will look something like this:
Your identification has been saved in /Users/you/.ssh/id_rsa.
# Your public key has been saved in /Users/you/.ssh/id_rsa.pub.
# The key fingerprint is:
# 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db firstname.lastname@example.org
Step 4: Move key to remote server
Now that you have created a key, let’s move it to a remote server so we can connect to it.
First you will need to know the username of the account on the remote machine you will be connecting to, and you will need to know the remote machines address (either a fully qualified domain name, or an IP address).
Now, in the terminal, you will issue this command:
cat ~/.ssh/id_rsa.pub | ssh email@example.com "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
If you are on a Linux system, you can try the following shortened command that does the same thing.
To test that everything worked correctly, try to initiate an SSH session from your machine to the remote machine via the terminal. If it works, you should be prompted for your passphrase (unless you opted not to enter one) and once entered correctly, be looking at the prompt for a shell on the remote machine.
Category: OS X,Tutorial,UNIX,Web Development
Dear Safari Development Team –
As a web developer who is firmly in the Apple technology camp, I use your products every day. Mobile Safari on iOS and Safari on OS X. Safari has been my browser of choice since Steve Jobs released it upon the world on Janaury 7, 2003. Over the last couple of years though, Safari has taken several steps backwards as a web development tool.
First off, just loading a page with development tools open takes forever. I’m not sure when this bug was introduced, but it’s been there at least since Safari 7. Additionally, while other browsers like Chrome and Firefox have added tools to help simulate views on other device sizes and configurations, Safari has remained on the sidelines. I’m sure Apple would rather we use the iOS Simulator in Xcode and use the Web Inspector in Safari to inspect and analyze, but in many situations that is overkill. And not having options to simulate other devices that are not Apple means we have to turn to Chrome and Firefox to get these tasks done. Because believe it or not, people do buy devices that are not created by Apple.
I get and understand that Apple is a consumer focused company, and Safari’s feature set has reflected this to an increasing degree over the years. But I can tell you, when you lose the audience who develops web sites for a living, Safari will start to have a harder time existing on all platforms. If you don’t believe me, go ask the Internet Explorer team up in Redmond.
I could spend hours pointing to all that has gone wrong in the Safari Web Development tools, but I think at this point, it would be easier to just say this: Fork the web inspector that Chrome has now (which is forked from the Webkit inspector anyway), and use that as a starting point. Google has taken what Apple had initially done with web inspector and made it so much better. It pains me to have to turn to Google Chrome for my web development needs, but that is exactly what has happened. And I am not alone. On my team, I was the last holdout using Safari as my primary browser for web development. But I’ve finally given in to the better tool, and unfortunately at this time, it is the Chrome Web Inspector.
I know several people on the Safari development team. I have been to many a mixer at WWDC with them. They are great people and have worked tirelessly to make a great product. Coming forward with these criticisms was tough for me, but I do it out of love. I’d love to return to using Safari as my primary browser for browsing and web development. I’m hoping in the future I can do just that.
Jesse Jackson has a long, storied history of pushing corporations to become more diverse. He’s been trying to crack the diversity nut at Apple for some time now. When Steve Jobs was in charge, Jackson couldn’t even get a call back. But now with Tim Cook at the helm, Jesse is getting Facetime and a chance to make his case to the CEO of the largest company in America.
We were fortunate enough to have our microphones in the room when the historic meeting took place. Here’s the transcript.
JJ: Tim! So glad that you agreed to see me! I’ve been looking forward to this meeting for some time.
TC: Good to see you Mr. Jackson, I –
JJ: Tim – please, let’s dismiss with the formalities – call me Jesse.
TC: Sure, OK. Jesse, before we begin, I’d just like to reiterate that Apple has had an incredibly successful quarter. We’ve shipped more iPhones than ever before. Our Mac sales have never been stronger. We’ve opened 3 new Apple Stores in the last few months, and –
JJ: Hold up Tim. Are you giving me the Keynote opening recap? Really? Can we just jump to the heart of the matter?
TC: I didn’t even get to the incredible momentum we are building with the Apple Watch!
JJ: I get it, Tim. Apple is on an incredible roll. I know that. Do you think I’d be here if Apple was in the shape it was in during the mid 90s?
TC: Touché, Jesse. Touché.
JJ: So cutting to the chase, Apple needs to be more diverse. We have a black man in the White House, and I still don’t see any people of color in your leadership positions. Frankly, I’m embarrassed for you. I’d like to –
TC: Hold up there Jesse. We have a person of color in leadership. His name is Andre. You may know him by his stage name of Dr. Dre.
JJ: You’re really going to use Dr. Dre as an example?
TC: He’s a senior member of our leadership team. Of course I am.
JJ: Look, first of all, Dre isn’t even listed on your leadership page. Second, you had to go out and buy Dr. Dre to get him on your leadership team. You paid like, three billion dollars to add a black man with street cred to your leadership team. Now honestly, I think you overpaid. I mean, I could have gotten you 50 cent for a hundred grand and a few Mac Pros. You could have gotten 10 prominent African American leaders for that billion. But whatever. You went with the most expensive black man you could find. And you still don’t put him on your leadership page!
TC: Jesse, Dre is an important member of our team, he’s –
JJ: Tim, cut the bullshit. What’s Dre’s title at Apple?
TC: He doesn’t have one. He was insistent that –
JJ: He doesn’t have a title? Then how can you even say he’s in a position of leadership there?
TC: Well, he does have the billion dollars from the Beats sale. Plus, he gets to keep his own hours. And the kicker is he’s got the primo parking space out front.
JJ: Tim, I really don’t know how to respond to that. I’m going to move on from Dre and talk about the one African American you have on your leadership page, Denise Young Smith.
TC: A lovely woman! And so accomplished! She’s…
JJ: Cut the bullshit Tim. You have her listed at the bottom of the page for christ’s sake!
TC: We saved the best for last?
JJ: Tim, your time is precious, so I’m going to be blunt. I’d like to see you set a goal of Apple’s workforce becoming 20% African American in 5 years time.
TC: Are you serious? Do you know how difficult it is to find qualified African Americans in the field of software and hardware engineering?
JJ: It can’t be that hard.
TC: Have you been to any of our World Wide Developers Conferences?
JJ: I don’t recall getting an invite to that Tim.
TC: Well, I have. Let me paint a picture for you Jesse. Every year we invite around 5000 developers to this conference. It’s an excellent representation of the talent pool with the skills that exist to create the next great software for the iPhone, iPad and Mac. Of those 5000 developers, do you know how many are African American?
JJ: Please, Tim. Enlighten me.
TC: Well, I don’t have exact numbers, because we don’t ask that question on the WWDC application form. But anyone who has been there will tell you it’s whiter than a KKK rally. I feel really bad for the handful of black guys that do attend. They stand out like Lena Dunham at the Victoria Secret’s Fashion Show, bless their hearts.
JJ: I’d like to talk about those black developers you just mentioned Tim.
JJ: I’ve heard, and please correct me if I’m wrong, that those few African American developers at the conference weren’t even Americans! They were Australian Aborigines!
TC: Well, this is embarrassing.
JJ: You had to go to the whole other side of the world to get a few black men?
TC: You don’t have all the facts Jesse. Yes, they were Australian Aborigines. But in our defense, they developed a really cool App that lets you use your iPhone as a field guide in the bush, and…
JJ: Let me cut to the chase Tim. I’d like a seat on Apple’s board, a generous donation to the Rainbow Push Coalition, and a commitment from Apple to increase your African American employees up to 20% of your workforce in 5 years.
TC: You are not getting a seat on Apple’s board Jesse.
JJ: Why not? You have Al Gore on your board.
TC: Your point?
JJ: My point is you have one useless gas bag on your board, what’s the harm in having another one? I bring more to the table than Al does anyway. I’m black, god damn it! I walked with Martin Luther King! He died in my arms, for christ’s sake!
TC: The board thing isn’t happening Jesse. Now, on your other points… What if I told you I could increase our persons of color to 20% in 6 months, would that interest you?
JJ: Of course it would Tim. Please elaborate.
TC: Well, we’ve been talking about building a new large R&D facility for some time, and I’d like for it to be primarily staffed by persons of color. I think we can make that happen in 6 months.
JJ: That sounds great! I knew we could come to an agree – wait – you said “persons of color” twice. Are we talking blacks?
TC: Well, actually, no. They’re darker skinned people, yes, but they would be primarily of Asian Indian descent, and…
JJ: Your R&D facility, would it be based in India?
TC: Uh, well, yes. Yes it would.
JJ: Come on Tim, do you think I’m some rank amateur? I wrote the book on race hustling! I’m going to be specific now. I want African Americans – black Americans – to be hired in greater numbers at Apple or I’m going to make it my mission to be on the news every night saying how Apple isn’t a company that reflects the population of it’s home country.
TC: You wouldn’t da-
JJ: I would. I will. I’ve got nothing better to do with my time, Tim.
TC: Ok, on to your request for a donation to the Rainbow Push Colation. What’s your price Jesse?
JJ: A billion dollars.
TC: Are you serious? You want a billion dollars.
JJ. Yes. A billion dollars. And a pair of Beats Studio Wireless signed by Dr. Dre.
TC: Jesse, you have yourself a deal. It’s been a pleasure doing business with you.
Photo Credit: Butch Wing, Rainbow Push Coalition