restrict ssh root login / allow root to rsync

Is there a way to restrict root login via ssh but allow root to rsync from another box?
Who is Participating?
woolmilkporcConnect With a Mentor Commented:
you could add
PermitRootLogin forced-commands-only
to sshd_config.
This way root login with public key authentication will be allowed, but only if the command option has been specified, allowing for e.g. rsync but not a shell login.
You can restrict root to login directly - first login with user, then use "su" command to become root and do everything You need. Also i would suggest connecting to ssh while using RSA keys, which is more secure connection.
Here is a link how to do this on ubuntu (it is basically the same for all distros):

P.s. also You can restrict access to ssh service from IP's You want by configuring Your firewall

Good Luck!
forgot to mention the link for permitting direct root access
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.