I
I
im_dimas2016-03-31 00:09:09
SSH
im_dimas, 2016-03-31 00:09:09

How to prevent a user from ssh login (putty)?

useradd -m -g gameservers -p pass user
How to prevent him from logging in without adding arguments -s /sbin/nologin?
PS: newbie

Answer the question

In order to leave comments, you need to log in

4 answer(s)
N
Nikon_NLG, 2016-03-31
@Nikon_NLG

/etc/default/useradd
....
# Default values ​​for useradd(8)
#
# The SHELL variable specifies the default login shell on your
# system.
# Similar to DHSELL in adduser. However, we use "sh" here because
# useradd is a low level utility and should be as general
# as possible
SHELL=/bin/sh
...

K
ky0, 2016-03-31
@ky0

Do not give him a password and check the sshd config for the PermitEmptyPasswords parameter.

A
AVKor, 2016-03-31
@AVKor

Make an entry by key in the OpenSSH server config. Well, in the absence of this, this user simply cannot log in via ssh. Will receive:
Permission denied (publickey).

A
Azazel PW, 2016-03-31
@azazelpw

It can simply make authorization to the server using a certificate via ssh, and not a password.
And to be honest, I don’t understand, do you shine ssh on the entire Internet?
just write in the iptables rules
where ssh is allowed
-A INPUT -p tcp -m state --state NEW -m tcp -s %IP% --dport 22 -j ACCEPT

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question