1

I'm executed this commands with root user i'm on a CentOS 6.3 server:

#useradd newuser
#passwd newuser

#visudo

then I added this line at end of file:

AllowUsers newuser

#service sshd restart
#exit

Now, I can't access server with deployer or root user! Both accounts return:

**Permission denied, please try again.**

Any suggestions?

EDIT: Why add AllowUsers newuser dont allows newuser to login by ssh?

Rodrigo
  • 179
  • 3
  • 12

2 Answers2

3

AllowUsers, quoting man sshd_config, "If specified, [allows] only user names that match one of the patterns".

To work around the problem, try logging in as newuser, and then use sudo -i (if newuser is allowed to run the command) or su root (if you know the root password) to become root and take the AllowUsers line out. After modifying sshd_config, restart sshd.

chutz
  • 7,888
  • 1
  • 29
  • 59
0

Make sure port 22 is open:

netstat -tulpn | grep :22

I'm assuming you have not turned off iptables. You can either a.) turn them off

service iptables save
service iptables stop
chkconfig iptables off

Or, add a rule:

vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
service iptables restart

Then restart ssh, root login via ssh is disable by default (usually) so you would need to edit the ssh config if you want root login:

vi /etc/ssh/sshd_config
PermitRootLogin:yes
colealtdelete
  • 6,017
  • 2
  • 30
  • 34