0

I already have SFTP for root user enabled on my server but I do not want any user to use root to execute any statements on the terminal. They should use their accounts. I have tried setting PermitRootLogin no in the sshd_config but I could not upload files to the server using SFTP. I also tried changing the shell to nologin and false but I cannot upload files.

So my issue is how can I be able to securely FTP files using root but not be able to use root on the terminal via ssh?

0

1 Answer 1

3

You can't. The important part is, that whatever configuration files you change to disallow a root shell, a root SFTP can just overwrite it with a file of his or her chosing or alterntively replace the sftp executable with whatever he or she wants. Even adding a simple cron file to start a reverse shell will do the trick.

In short: root SFTP implies root shell.

I recommend you rethink the need for a root SFTP - most likely some work on file/directory permissions will do the trick much more securely (or a bindfs mount if must be)

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.