LinuxQuestions.org
Review your favorite Linux distribution.
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 01-18-2014, 02:50 AM   #1
massy
Member
 
Registered: Nov 2013
Distribution: CentOS 6.4
Posts: 142
Blog Entries: 1

Rep: Reputation: Disabled
Perform SSH Without Entering Password on openSSH


I used this link to do it, but it didn't work!!!
http://www.debian-administration.org/articles/152
 
Old 01-18-2014, 03:12 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371
Quote:
Originally Posted by massy View Post
I used this link to do it, but it didn't work!!!
http://www.debian-administration.org/articles/152
What exactly doesn't work?
- Is one of the steps giving problems?
- Are you not able to use passwordless login after you done all the steps?
- ???

Have you checked the What if it doesn't work? section?

Here's an alternative link: SSH login without password
 
Old 01-18-2014, 03:55 AM   #3
massy
Member
 
Registered: Nov 2013
Distribution: CentOS 6.4
Posts: 142
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by druuna View Post
What exactly doesn't work?
- Is one of the steps giving problems?
- Are you not able to use passwordless login after you done all the steps?
- ???

Have you checked the What if it doesn't work? section?

Here's an alternative link: SSH login without password
Yes, I read it wholly.
when I ssh to the remote-host, It wants password.
 
Old 01-18-2014, 04:05 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371
Quote:
Originally Posted by massy View Post
Yes, I read it wholly.
when I ssh to the remote-host, It wants password.
You say you read the article, but did you check and recheck the steps taken?

These are the most common reasons why it doesn't seem to work (as explained in the What if it doesn't work? section):
- File permissions cause problems.
- The remote SSH server hasn't been setup to allow public key authentication.

You can use the -v flag to get more info about what is going on during the execution of the ssh command:
Code:
ssh -v username@host
Substitute username and host with the appropriate values.
 
Old 01-18-2014, 04:19 AM   #5
massy
Member
 
Registered: Nov 2013
Distribution: CentOS 6.4
Posts: 142
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by druuna View Post
You say you read the article, but did you check and recheck the steps taken?

These are the most common reasons why it doesn't seem to work (as explained in the What if it doesn't work? section):
- File permissions cause problems.
- The remote SSH server hasn't been setup to allow public key authentication.

You can use the -v flag to get more info about what is going on during the execution of the ssh command:
Code:
ssh -v username@host
Substitute username and host with the appropriate values.
I've checked all of them.
This is the last part of ssh -v :

Host '10.8.0.8' is known and matches the RSA host key.
debug1: Found key in /home/farid/.ssh/known_hosts:22
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/farid/.ssh/identity
debug1: Offering public key: /home/farid/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/farid/.ssh/id_dsa
debug1: Next authentication method: password
 
Old 01-18-2014, 05:55 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371
On both systems, what is the output of the following command:
Code:
ls -la /home/farid/.ssh
(I'm assuming both systems use /home/farid, change the username if that is not the case).

On both systems, as root user execute and post the results:
Code:
grep ssh /var/log/auth.log
EDIT: Also post the output form the following (as root, both systems):
Code:
grep -i Authentication /etc/ssh/sshd_config

Last edited by druuna; 01-18-2014 at 06:09 AM.
 
Old 01-18-2014, 06:25 AM   #7
massy
Member
 
Registered: Nov 2013
Distribution: CentOS 6.4
Posts: 142
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by druuna View Post
On both systems, what is the output of the following command:
Code:
ls -la /home/farid/.ssh
(I'm assuming both systems use /home/farid, change the username if that is not the case).

On both systems, as root user execute and post the results:
Code:
grep ssh /var/log/auth.log
I'm root just on the remote host, here I don't have permission to root access.

The output of ls -la .ssh on my host(farid):
drwx------. 2 farid root 4096 Jan 18 11:14 .
drwx------. 7 farid farid 4096 Jan 18 15:03 ..
-rw-------. 1 farid root 1675 Jan 18 11:14 id_rsa
-rw-r--r--. 1 farid root 403 Jan 18 11:14 id_rsa.pub
-rw-r--r--. 1 farid root 24864 Jan 18 08:56 known_hosts


The output of it on the remote host( as a root):

drwxr-xr-x 2 1000 sudo 4096 Jan 18 11:36 .
drwxrwxrwx 6 1000 sudo 4096 Jun 30 2013 ..
-rwx------ 1 root root 806 Jan 18 13:26 authorized_keys
-rw------- 1 1000 sudo 1679 Apr 21 2013 id_rsa
-rw-r--r-- 1 root root 394 Aug 3 15:48 id_rsa.pub
-rw-r--r-- 1 root root 442 Jan 15 20:13 known_hosts

-----------------------------------------------------------------
grep ssh /var/log/auth.log (remote host)


Jan 18 15:43:11 RSU-1-2 sshd[9120]: pam_unix(sshd:session): session closed for user root
Jan 18 15:43:11 RSU-1-2 sshd[9120]: pam_env(sshd:setcred): Unable to open env file: /etc/default/locale: No such file or directory
Jan 18 15:44:55 RSU-1-2 sshd[9127]: Authentication refused: bad ownership or modes for directory /root/.ssh
Jan 18 15:45:10 RSU-1-2 sshd[9127]: Connection closed by 10.8.0.1 [preauth]
Jan 18 15:47:14 RSU-1-2 sshd[9129]: Authentication refused: bad ownership or modes for directory /root/.ssh
Jan 18 15:48:19 RSU-1-2 sshd[9129]: Accepted password for root from 10.8.0.1 port 35684 ssh2
Jan 18 15:48:19 RSU-1-2 sshd[9129]: pam_env(sshd:setcred): Unable to open env file: /etc/default/locale: No such file or directory
Jan 18 15:48:19 RSU-1-2 sshd[9129]: pam_unix(sshd:session): session opened for user root by (uid=0)
Jan 18 15:48:20 RSU-1-2 sshd[9131]: pam_env(sshd:setcred): Unable to open env file: /etc/default/locale: No such file or directory

-------------------------------------------------
grep -i Authentication /etc/ssh/sshd_config (remote host)

# Authentication:
RSAAuthentication yes
PubkeyAuthentication yes
RhostsRSAAuthentication no
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
ChallengeResponseAuthentication no
#PasswordAuthentication yes
#KerberosAuthentication no
#GSSAPIAuthentication no
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
 
Old 01-18-2014, 06:36 AM   #8
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371
You obviously did NOT follow the What if it doesn't work? section:
Quote:
Originally Posted by massy
Jan 18 15:43:11 RSU-1-2 sshd[9120]: pam_unix(sshd:session): session closed for user root
Jan 18 15:43:11 RSU-1-2 sshd[9120]: pam_env(sshd:setcred): Unable to open env file: /etc/default/locale: No such file or directory
Jan 18 15:44:55 RSU-1-2 sshd[9127]: Authentication refused: bad ownership or modes for directory /root/.ssh
Jan 18 15:45:10 RSU-1-2 sshd[9127]: Connection closed by 10.8.0.1 [preauth]
Jan 18 15:47:14 RSU-1-2 sshd[9129]: Authentication refused: bad ownership or modes for directory /root/.ssh
Jan 18 15:48:19 RSU-1-2 sshd[9129]: Accepted password for root from 10.8.0.1 port 35684 ssh2
Jan 18 15:48:19 RSU-1-2 sshd[9129]: pam_env(sshd:setcred): Unable to open env file: /etc/default/locale: No such file or directory
Jan 18 15:48:19 RSU-1-2 sshd[9129]: pam_unix(sshd:session): session opened for user root by (uid=0)
Jan 18 15:48:20 RSU-1-2 sshd[9131]: pam_env(sshd:setcred): Unable to open env file: /etc/default/locale: No such file or directory
The above is mentioned! Fix the permissions/ownership of the files in the .ssh directory. All files should be owned by the user (farid:farid on one side and root:root on the other side).

One other thing, which is not mentioned in the article you linked to: You should not ssh as root or directly into a root account (possible security issue's).
 
1 members found this post helpful.
Old 01-18-2014, 12:28 PM   #9
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,506

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
read the links in my signature. they will help.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Able to use scp and ssh without entering the password Drigo Linux - Newbie 4 07-21-2011 12:13 AM
entering without root password shanecaldeiro Linux - Newbie 8 05-29-2009 09:52 AM
Tntrepid does not allow entering any password jdtiede Ubuntu 1 01-18-2009 10:18 PM
Setting up ssh connections without a password (OpenSSH) Suinatsa Linux - Software 2 07-05-2006 02:46 AM
Entering Password with a Space via CLI username132 Linux - Software 2 04-01-2006 09:57 PM


All times are GMT -5. The time now is 01:19 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration