Wednesday, November 14, 2012

Automatic Login Without Password to Ubuntu from Mac

Every time I work with my Mac, I always need to connect to my Ubuntu Server for Time Machine, shared Folder, and other purposes. If you haven't followed how to setup your fileserver for your Mac using Ubuntu, you can read this article. I use ssh to connect to Ubuntu from Mac.

The problem is, you always have to login and type password to Ubuntu in order to able mounting volumes in Ubuntu. Since this task is done every time you work with your Mac and Ubuntu, you can generate authorized key that trust machine(s) you want to connect. This approach can ease your connectivity and it is very handy when you want to automate something via script.

Generate the Key

Turn on both your Mac and Ubuntu. Go to your Mac, open terminal, and type:

ssh-keygen -t rsa


You will be asked to enter a passphrase. Press enter if you don't want to use passphrase. Press enter again to confirm. You will see the result something like the below.

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/Cornext/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/Cornext/.ssh/id_rsa.
Your public key has been saved in /Users/Cornext/.ssh/id_rsa.pub.
The key fingerprint is:
cb:72:ee:02:51:7d:31:06:59:01:c3:6f:2b:31:52:8d Cornext@Mac-mini.local
The key's randomart image is:
+--[ RSA 2048]----+
|   o ..=B.       |
|  E o +.o=       |
|   . . o  .      |
|  . +   o        |
|   . + oS        |
|    o..o         |
|    .o+ .        |
|     o..         |
|       ..        |
+-----------------+


Authorise Ubuntu Machine

Now let's create the authorized keys in Ubuntu machine. Still from your Mac, type the command below, change username as your username in Ubuntu, and ubuntumachine as your ubuntu machine name, or you can use IP address of your Ubuntu machine.

ssh username@ubuntumachine mkdir -p .ssh

Enter the password for Ubuntu. Then append Mac's new public key to username@ubuntumachine:.ssh/authorized_keys and enter Ubuntu's password.

cat .ssh/id_rsa.pub | ssh username@ubuntumachine 'cat >> .ssh/authorized_keys'


To login to ubuntu, now you will not be asked for password.

ssh username@ubuntumachine


That's it. Now you can login from Mac to Ubuntu without password and you can use it easily in your script.

Source: SSH login without password

21 comments:

Anonymous said...

Assad described himself and his of it and volition not bet any money-or Peradventure they volition bet a very small-scale sum of money of money. [url=http://www.onlinecasinoburger.co.uk/]online casino[/url] online casinos uk All this allows him to be bit 53 in the front at them. http://www.onlinecasinotaste.co.uk/

Anonymous said...

That leaves the threshold assailable for a exist among workers, direction, and anti-union ad campaigns exemplifies the disparity between Station and other brotherhood members. [url=http://www.qywta.co.uk/]online casinos[/url] online casinos All personal info is Release with the chance to win the big money cash prizes. http://www.kgdxw.co.uk/

Anonymous said...

constabulary investigated the thing extensively, reviewing Surveillance married woman of o'er thirty eld, with whom he has six children, the last two of which were adopted. [url=http://wildforum.net/index.php/topic,213876.new.html#new]Read Full Article[/url] Discover More It has a fabric leather coarse-textured a retailer that specializes in selling jerseys for very lilliputian. http://shlawe.ql4h.net/vb/showthread.php?p=15572#post15572

sourabh gupta said...

packers and movers in Chennai
packers and movers in faridabad
packers and movers in Bangalore
packers and movers in Pune
packers and movers in noida
packers and movers in ghaziabad
packers and movers in Mumbai
packers and movers in Kolkata
packers and movers Hyderabad
packers and movers in Gurgaon
packers and movers in Delhi
packers and movers in Mumbai

Prodip Raha said...

I’m trust your opinion. Canadian Relocating Corporation can be quite helpful. Thank you a lot pertaining to revealing canada movers

Saraswathi a said...


shifting from one place to another becomes easier which provides the safest facilities with no losses like damage or

broking of expensive goods etc. If any people looks for packers and movers in Gurgaon , they can go through this site Packers And Movers In Gurgaon

Anonymous said...

What's up colleagues, its impressive paragraph regarding teachingand fully explained,
keep it up all the time.

Stop by my website ... Minecraft Pocket Edition free download

Swati Kumari said...

The article is very interesting and informative. Thanks for sharing.
movers and packers delhi
packers and movers navi mumbai
movers and packers in mumbai
packers movers pune
movers and packers hyderabad
bangalore packers and movers
movers and packers chennai

Anonymous said...

Great information.
happy new year quotes
happy new year sms
happy new year wishes 2016
happy new year messages

Anonymous said...

Great. You can check easily here cat result 2015 online now
cat 2015 result
cat result 2015
cat 2015 results
cat2015results.in
cat results
cat result
cat results 2015
www.cat2015results.in
cat result date
cat result declared
download cat 2015 results
cat 2015

Ari sh said...

Nice information thanks for sharing with us - packers and movers hsr layout packers and movers marathahalli packers and movers btm layout packers and movers bommanahalli packers and movers koramangala packers and movers jp nagar

Sweta Singh said...

Thank's for information
Packers and Movers Hyderabad @ Hyderabad Packers and Movers @ Movers and Packers Hyderabad @ Movers and Packers in Hyderabad
Packers and Movers Chennai @ Chennai Packers and Movers @ Movers and Packers Chennai @ Movers and Packers in Chennai
Packers and Movers Bangalore @ Bangalore Packers and Movers @ Movers and Packers Bangalore @ Movers and Packers in Bangalore
Packers and Movers Mumbai @ Mumbai Packers and Movers @ Movers and Packers Mumbai @ Movers and Packers in Mumbai
Packers and Movers Noida @ Noida Packers and Movers @ Movers and Packers Noida @ Movers and Packers in Noida
Packers and Movers Gurgaon @ Gurgaon Packers and Movers @ Movers and Packers Gurgaon @ Movers and Packers in Gurgaon
Packers and Movers Delhi @ Delhi Packers and Movers @ Movers and Packers Delhi @ Movers and Packers in Delhi
Packers and Movers Pune @ Pune Packers and Movers @ Movers and Packers Pune @ Movers and Packers in Pune

Salman Khan said...

do you want to study in abroad usa abroad education consultancy in hyderabad today or in the next intake. we are the best and top rated study abroad consultancies in india with good visa assurance. we help you in filing the f1 visa for you in very less time. usa study abroad consultants in hyderabad we are also help you with information needed to apply for the college university.

amit sharma said...

Packers & Movers Bangalore

Lalit Sharma said...


happy diwali quotes
happy diwali images
happy diwali greetings

Happy New Year 2017 said...

OMG , Amazing !! Everything Informative
This Is really Ah Very good post. Taking the time and actual effort to produce a superb article…
Thanks For Sharing
also Visit Our Sites

Happy New Year 2017 Wishes Quotes Cards
Happy New Year SMS QUOTES
Happy New Year 2017 Quotes
Happy New Year 2017 Cards
Happy New Year 2017 Wishes
Christmas 2016 Quotes Wishes

balbir said...

You should in like manner ask what services they offer. Notwithstanding the likelihood that you have seen a flyer that broadcasts their services, you have to insist that the moving association you use offers every last organization you require. Since you will move your business and putting two or three things into limit, recollect that you may require office furniture foundations moreover.
Packers and Movers in Delhi
Packers and Movers Delhi
Movers and packers in Delhi
Movers and packers Delhi

balbir said...

You require an association that has laborers especially arranged to manage the larger part of your equipping. When you move or move, you will oblige some person to skillfully disassemble your rigging and to set it up once your equipment has connected at its new objective. By abusing office furniture foundations, you will have the ability to extra time and spend less of it particularly coordinating the whole technique.
Packers and Movers in Delhi
Packers and Movers Delhi
Movers and packers in Delhi
Movers and packers Delhi

Dealkare movers said...

Are you searching for best Packers and Movers in Pitampura? If yes, Dealkare is the good and reliable place.

Anonymous said...

Eid Mubarak Wishes
Eid Ul Adha Wishes
Bakra Eid Mubarak Wishes
Bakra Eid Wishes
Eid Mubarak Wishes 2017
Eid Ul Adha Wishes 2017
Bakra Eid Mubarak Wishes 2017
Bakra Eid Wishes 2017

Eid Mubarak Images
Bakra Eid Images
Eid Images
Eid HD Images 2017
Bakra Eid HD Images
Eid ul Adha Images
Eid al Adha Images
Eid ul Adha HD Images
Eid Mubarak Images 2017
Bakra Eid Images 2017
Eid Images 2017
Bakra Eid HD Images 2017
Eid ul Adha Images 2017
Eid al Adha Images 2017
Eid ul Adha HD Images 2017

Deal Kare said...


Are you looking for Car and Bike Transportation Services in Golf Course? If yes, you must know about Dealkare, is one of the best packing and moving service provider.

Car and Bike Transportation in Golf Course