Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I want to give my users option of logging to the system. They should have posibillity for choosing option betweend logging to the system with their default password or one-time password OTPW.
I installed OTPW in my Debian.
Here is my /etc/pam.d/sshd file:
Quote:
# PAM configuration for the Secure Shell service
# Read environment variables from /etc/environment and
# /etc/security/pam_env.conf.
auth required pam_env.so # [1]
# In Debian 4.0 (etch), locale-related environment variables were moved to
# /etc/default/locale, so read that as well.
auth required pam_env.so envfile=/etc/default/locale
# OTPW support
auth sufficient pam_otpw.so
# Standard Un*x authentication.
@include common-auth
# Disallow non-root logins when /etc/nologin exists.
account required pam_nologin.so
# Uncomment and edit /etc/security/access.conf if you need to set complex
# access limits that are hard to express in sshd_config.
# account required pam_access.so
# Standard Un*x authorization.
@include common-account
# Standard Un*x session setup and teardown.
@include common-session
# Print the message of the day upon successful login.
session optional pam_motd.so # [1]
# Print the status of the user's mailbox upon successful login.
#session optional pam_mail.so standard noenv # [1]
# OTWP support
session optional pam_otpw.so
# Set up user limits from /etc/security/limits.conf.
session required pam_limits.so
# Set up SELinux capabilities (need modified pam)
# session required pam_selinux.so multiple
# Standard Un*x password updating.
@include common-password
Here is my /etc/ssh/sshd_config file:
Quote:
# Package generated configuration file
# See the sshd(8) manpage for details
# What ports, IPs and protocols we listen for
Port 666
# 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
ServerKeyBits 768
# Logging
SyslogFacility AUTH
LogLevel INFO
# Authentication:
LoginGraceTime 120
PermitRootLogin no
StrictModes yes
# 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 yes
# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes
# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
X11Forwarding yes
X11DisplayOffset 10
# Wyswietalnie MOTD. Wlaczenie tej opcji spowoduje podwojne
# wyswietlenie MOTD
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#MaxStartups 10:30:60
# Monit pokazujacy sie przed zalogowaniem
Banner /etc/issue.net
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM yes
# Czas na zalogowanie sie do serwera
#LoginGraceTime 120
# Maksymalna liczba proba zalogowania sie
MaxAuthTries 3
# Maksymalna liczba otwartych sesji
MaxSessions 2
LoginGraceTime 1800
ClientAliveInterval 0
UsePrivilegeSeparation yes
During logging I don't have information of what password I have to put. Here is information from my logs:
Quote:
Nov 24 22:13:41 borekfalecki sshd[8152]: pam_unix(sshd:session): session opened for user seprob by (uid=0)
Nov 24 22:13:41 borekfalecki sshd(pam_otpw)[8152]: pam_get_data() failed
Yes, I did. It looks like following: I'm logging and system ask me about one-time password. After this ask me about my system password and then I'm in. Error in logs appears again.
Nov 27 12:59:21 borekfalecki sshd(pam_otpw)[16240]: pam_sm_authenticate called, flags=1
Nov 27 12:59:21 borekfalecki sshd(pam_otpw)[16240]: username is seprob
Nov 27 12:59:21 borekfalecki sshd(pam_otpw)[16240]: uid=0, euid=0, gid=0, egid=0
Nov 27 12:59:21 borekfalecki sshd(pam_otpw)[16240]: challenge: 009
Nov 27 12:59:21 borekfalecki sshd(pam_otpw)[16240]: calling conversation function
Nov 27 12:59:36 borekfalecki sshd(pam_otpw)[16240]: conversation function returned 0
Nov 27 12:59:36 borekfalecki (pam_otpw)[16240]: Password 0 = '++==Sq7t'
Nov 27 12:59:36 borekfalecki (pam_otpw)[16240]: Prefix = ''
Nov 27 12:59:36 borekfalecki (pam_otpw)[16240]: hash(password): 'by6aE7Wq+arn', hash from file: 'Nt55czUhzBY%'
Nov 27 12:59:36 borekfalecki (pam_otpw)[16240]: Entered password did not match.
Nov 27 12:59:36 borekfalecki (pam_otpw)[16240]: Removing lock file
Nov 27 12:59:36 borekfalecki sshd(pam_otpw)[16240]: incorrect password from user seprob
Nov 27 12:59:41 borekfalecki sshd[16236]: Accepted keyboard-interactive/pam for seprob from 91.150.220.49 port 29925 ssh2
Nov 27 12:59:41 borekfalecki sshd[16236]: pam_unix(sshd:session): session opened for user seprob by (uid=0)
Nov 27 12:59:41 borekfalecki sshd(pam_otpw)[16236]: pam_get_data() failed
Nov 27 12:59:45 borekfalecki sshd[16048]: pam_unix(sshd:session): session closed for user seprob
Hmm, password should looks like "++== Sq7t". It looks like system doesn't see or doesn't get ma spacebar.
I don't think you're supposed to enter the spaces, that's just the way the output is formatted when you generate them for readability - please try without
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.