LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-21-2009, 02:22 PM   #1
sr_25
Member
 
Registered: Nov 2005
Location: Colorado
Distribution: Debian
Posts: 133

Rep: Reputation: 16
ssh disable passwords use keys with passhphases.


I am running Debian Lenny and I cannot figure out how to ONLY use keys for ssh logons, right now I can use username/password or key/passphrase. I want to disallow username/password option and have read many online examples of how to edit sshd_conf here is my current sshd.conf with my edits in bold:

Code:
# Package generated configuration file
# See the sshd(8) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 3600
KeyRegenerationInterval 2700
#ServerKeyBits 768
ServerKeyBits 2048

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
#PermitRootLogin yes
PermitRootLogin no # I can't believe yes is default.
StrictModes yes


RSAAuthentication yes
PubkeyAuthentication yes  # this obviously enables the keys but doesn't disable passwords.
#AuthorizedKeysFile     %h/.ssh/authorized_keys
AuthorizedKeysFile	%h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
PasswordAuthentication no  # shouldn't this disable passwords.

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

#UsePAM yes
UsePAM no  # either way makes no difference.
Could someone please point out to me where I have gone wrong?
 
Old 06-21-2009, 04:01 PM   #2
sr_25
Member
 
Registered: Nov 2005
Location: Colorado
Distribution: Debian
Posts: 133

Original Poster
Rep: Reputation: 16
I just tried to ssh with root and it worked! I have setup PermitRootLogin to no. What the hell have I done wrong?
 
Old 06-21-2009, 07:14 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Here's a dumb qn; did you restart the sshd daemon? It only reads the cfg file at startup, not every time you edit it (unlike cron for example).
 
Old 06-21-2009, 07:28 PM   #4
sr_25
Member
 
Registered: Nov 2005
Location: Colorado
Distribution: Debian
Posts: 133

Original Poster
Rep: Reputation: 16
Yes, I used:
Code:
/etc/init.d/ssh restart
 
Old 06-21-2009, 08:29 PM   #5
sr_25
Member
 
Registered: Nov 2005
Location: Colorado
Distribution: Debian
Posts: 133

Original Poster
Rep: Reputation: 16
Unhappy

I have done a little more testing and now I am even more confused than before.

sshd_conf:

If
Code:
StrictModes yes
then both accounts listed after DenyUsers are still allowed ssh access, including root.

If
Code:
StrictMode no
then DenyUsers are actually denied!

This is really weird, or I am a complete moron!
 
Old 06-21-2009, 09:33 PM   #6
sr_25
Member
 
Registered: Nov 2005
Location: Colorado
Distribution: Debian
Posts: 133

Original Poster
Rep: Reputation: 16
I think I finally figured it out. I have been using /etc/init.d/ssh restart. I had to reboot the Debian server for the changed to take effect! Everything that I have read online doesn't say I needed a reboot. Wow, I wasn't expecting that. So please disregard my previous post.

Thanks.
 
Old 06-21-2009, 09:45 PM   #7
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Are you sure that ssh was the server and not the client? What else is in /etc/init.d in debian?
 
  


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
SSH host keys VS SSH keys kenneho Linux - Security 3 09-11-2008 06:03 AM
Disable complext passwords hunger Linux - Security 6 07-18-2008 06:01 AM
RSYNC without keys or passwords prompts? mago Linux - Server 2 06-13-2007 12:55 AM
Root & user logins : Passwords? Why not encryption keys instead? furfurdemon666 Linux - Security 4 07-02-2004 09:17 AM
Configuring SSH to accept only keys (already have keys) fr0st Linux - Security 3 11-04-2003 03:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:26 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