I need to set
PermitRootLogin no in Solaris 10 server, while still allowing two "peer" servers to have root access via ssh.
How can I achieve this?
Stack Exchange network consists of 181 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.Visit Stack Exchange
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
Adding the below lines in the end of
/etc/ssh/sshd_config is enough for this requirement:
Match Host unit1-priv0 PermitRootLogin yes Match Host unit0-priv0 PermitRootLogin yes
Use public/private key.
It is described for many times in internet so I don't think it is userful to repeate it in detail again.
A briefly summary what to do:
Now only these two clients and the users of the commands above have root access to the server and additionally no password is required anymore.
Maybe this is an good entry point to start over (steps #1 and #2)
PermitRootLogin nois set. In this case my answer does not work. Otherwise the question clearly says that two peers still need root login via ssh, even if
PermitRootLogin nois set. In this case this is an answer to the question and the use of keys is no bad advice/bad practice. I can't track your arguments/downvotes. And I would appreciate if you could justify please, why the use of keys is condideres as not best practice Jul 24, 2017 at 6:46
PermitRootLogin yesis bad practice. So maybe this is a misunderstanding? My answer advises to disable root login in the end. It is only required once to install the public key. After all
PermitRootLoginis set to
noat all and only the two - by OP - required peers can login by using their private key. So my answer is exactly what you say. Would you read my answer once again please and we solve this gordian knot. ;) Jul 25, 2017 at 5:56