Allow SFTP root access to the Linux Server – just for your own IP address

If you want to access your Linux server using SFTP and a root user, by default it can be disabled. Due to security reasons most server-providers disable that by default.

So, you can enable it yourself. But as it is not secure, you need to add some restrictions.

Such as, adding this feature only for your own static IP.

So let’s do that. Open your server’s sshd_config file by using this command.

nano /etc/ssh/sshd_config

Under the line Subsystem sftp /usr/lib/openssh/sftp-server you can paste 3 new lines.

Here is how it should look like:

Subsystem sftp  /usr/lib/openssh/sftp-server
Match Address 111.111.111.111
PasswordAuthentication yes
PermitRootLogin yes

Replace 11.111.111.111 with your own static IP address.

Then save and restart SSH by using

service ssh restart

That’s all. Now you can access to your server via SFTP, as a root user if you are connected to internet with your own static IP.

All other users will not be able to connect of course.

Get more useful WP tricks and snippets by subscribing to my mailclub.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.