LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-29-2016, 06:04 PM   #1
luofeiyu
Member
 
Registered: Aug 2015
Posts: 237

Rep: Reputation: Disabled
Why can't set ssh auto login without password?


Machin A is my local pc.
Machine B is my remote vps pc,its ip is vps_ip.

Step 1: Create Authentication SSH-Kegen Keys on machine A

ssh-keygen -t rsa -P ''
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):/root/.ssh/myvps
Your identification has been saved in /root/.ssh/myvps.
Your public key has been saved in /root/.ssh/myvps.pub.

Step2 Upload Generated Public Keys to machine B

scp /root/.ssh/myvps.pub root@vps_ip:/root/.ssh/authorized_keys

To login machine B with "ssh root@vps_ip" and execute
chmod 600 /root/.ssh/authorized_keys

To exit from machine B and relogin from machine A.

ssh root@vps_ip can't login without password ,why?

Last edited by luofeiyu; 12-29-2016 at 06:05 PM.
 
Old 12-29-2016, 06:26 PM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,631

Rep: Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696
Have you examined the logs for clues?
Have you checked permissions on the home folders, and the .ssh folders, and the files within the .ssh folders?
Have you done anything else to detect the cause of the problem or resolve the issue that we should know about?
Have you considered using the ssh-copy-id script from the openssh package for transporting keys properly?
 
Old 12-29-2016, 06:39 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,704

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
In addition.

ssh defaults to id_rsa. Have you tried

ssh -i ~/.ssh/myvps root@vps_IP

ssh-copy-id appends the selected public key to the authorized_keys files but there are many ways to accomplish the same task.
 
1 members found this post helpful.
Old 12-30-2016, 07:19 AM   #4
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,631

Rep: Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696
Quote:
Originally Posted by michaelk View Post
In addition.

ssh defaults to id_rsa. Have you tried

ssh -i ~/.ssh/myvps root@vps_IP

ssh-copy-id appends the selected public key to the authorized_keys files but there are many ways to accomplish the same task.
Re: ssh-copy-id: it does, but also does some permission checks also. Generally the manual steps do not nuless you add those steps to the process. I like a combined approach, where I use the ssh-copy-id, but then also manually check and correct permissions and ownership that it ignores but ssh WILL check.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto-login without password (KDM) help fixer1234 Debian 23 11-15-2017 09:40 PM
[SOLVED] ssh-keygen for auto ssh login not working R00ts Linux - Software 26 09-23-2012 01:40 PM
Automatic set no password SSH login Ricio Programming 2 08-02-2008 09:03 AM
How to set login and password and root password in suse 10.2 sirius57 SUSE / openSUSE 8 07-24-2007 09:51 AM
Auto-login Without user and password hraposo Fedora 1 07-12-2006 07:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration