How to set key based authentication in remote machine?

0 votes

I have my server-client scenario for my project. Server is in remote desktop. But every time I am running some program in my remote server, it asks me password. It is good for security purpose, but it takes time. 

Is there any way so that it will not ask password every time?

Thank You 

Apr 1 in Linux Administration by akhtar
• 10,580 points
31 views

1 answer to this question.

0 votes

Hi@akhtar,

You can set key based authentication in your server machine. For that you have to create one ssh key and copy that key in your remote system.

$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:uvGnlxsbPHSD99b2qQ/Oe0fNcYVtSf+q5WitlkpyXj8 root@master
The key's randomart image is:
+---[RSA 2048]----+
|              .+.|
|              ..=|
|               .o|
|           .   .o|
|        S o +  .=|
|       . o o o o+|
|      o . B..+=.o|
|       + =+**BEo+|
|      . o+==+*B+o|
+----[SHA256]-----+

$ ssh-copy-id 'remote ip'

Now, you can able to run your program without any password.
Thank You

answered Apr 1 by MD
• 23,050 points

Related Questions In Linux Administration

0 votes
1 answer

How do I use a shell script to SSH in to a remote machine to execute commands?

Your first problem can be solved like ...READ MORE

answered Jun 27, 2019 in Linux Administration by ajs3033
• 7,280 points
410 views
0 votes
1 answer

How to increase Swap Memory in CentOS 7?

Follow the below steps and procedures: Prerequisites Must have ...READ MORE

answered Oct 5, 2018 in Linux Administration by Frankie
• 9,810 points
3,700 views
–1 vote
1 answer

How to get octal file permission in linux?

You can use this: stat -c "%a %n" ...READ MORE

answered Jan 3, 2019 in Linux Administration by Omkar
• 69,060 points
254 views
0 votes
1 answer

How to take input from user in bash script?

You can use if-else branch to check ...READ MORE

answered Jan 31, 2019 in Linux Administration by Omkar
• 69,060 points
99 views
0 votes
1 answer
0 votes
1 answer

How do I set variable if a specific package version is installed in CFEngine?

Here is what you can do.Just use packagesmatching to ...READ MORE

answered Jul 12, 2018 in Other DevOps Questions by Atul
• 10,240 points
142 views
+5 votes
17 answers

What are job opportunities as a Linux System Administrator?

I just started working professionally as a ...READ MORE

answered Jul 18, 2018 in Career Counselling by eatcodesleeprepeat
• 4,750 points
1,417 views
0 votes
1 answer

AWS Simple AD : SSH based key Authentication for Linux instances

You can interact with SimpleAD in the ...READ MORE

answered Aug 29, 2018 in AWS by Priyaj
• 57,530 points
183 views
0 votes
1 answer

How to run GUI program in SSH server from remote desktop?

Hi@akhtar, First you have to configure SSH server ...READ MORE

answered Mar 31 in Linux Administration by MD
• 23,050 points
64 views
0 votes
1 answer

How to install python-poster in RedHat?

Hi@akhtar, To install python-poster in RedHat/CentOs, you can ...READ MORE

answered Feb 11 in Linux Administration by MD
• 23,050 points
74 views