How to login to server without enter password

you have an account on server and you have to login frequently, you are tired of typing ssh ……/ password?

RSA is your solution!

Firstly, goto home directory

cd ~

make sure you have a writable folder called ".ssh", if not you can create that folder:

mkdir .ssh
chmod +x .ssh

Secondly, generate rsa-key:

ssh-keygen -t rsa

You will be asked to provide some information such as where you want to save passphrase ( default is empty)… so on.

You can skip and leave it as default by just press key.
Then your key is created randomly.
The third, you have to upload your rsa-key to server:

ssh-copy-id USER@SERVERNAME

At this step, you will be asked the password of the server, just enter it.
To check whether you are success or not just try to login server ( if server donot ask your password, you are done!)

If you have multi machine, you have to concentrate authorized_keys file by adding content of id_rsa.pub to authorized_keys on server.

Still complex if you have a long server name!
open your .bashrc file:

vim ~/.bashrc

add following line at the end of bashrc:

alias NAME_YOU_WANT='ssh USER@SERVERNAME'

replace NAME_YOU_WANT by something you want it to be
USER= your user name
SERVERNAME= your server name.
logout and login your session ( to reload bashrc file) or simple ways: source ~/.bashrc
then to login to server, just type: NAME_YOU_WANT
That all!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

mlcvGru

Random thoughts on Machine Learning, Deep Learning and (sometimes) Computer Vision

LazyT

Góc nhỏ của Quyền

phanlan

we get what we give, sống là cho đi

Codeaholicguy

software engineer, team lead at #kobiton, blogger at @codeaholicguy

Maths 4 Physics & more...

Blog Toán Cao Cấp (M4Ps)

Vatlyvietnam's Blog

Thế Giới Song Song

Darren Wilkinson's research blog

Statistics, computing, data science, Bayes, stochastic modelling, systems biology and bioinformatics

Ông Xuân Hồng

Chia sẻ kiến thức và thông tin về Machine learning

Từ coder đến developer - Tôi đi code dạo

Lập trình viên giỏi không phải chỉ biết code

Computational Biology and Molecular Modelling

An interface between biology, chemistry and computer science

Moriator - I can do it!

Linux dễ dàng hơn bạn nghĩ!

VinaCode

Lập trình & Cuộc sống

Blog của Chiến

Học. Thực hành. Sáng tạo

Bespoke Blog

Science! Culture! Computational Engines!

Vuhavan's Blog

Just another WordPress.com weblog

%d bloggers like this: