How will I disable sftp?

Asked By 30 points N/A Posted on -



Hi techyv,

How will I disable sftp? My friend just make some move of enabling those file transfer protocol in my computer and when done making some secure transferring of files I would like to turn it off just for security purposes. I need a step by step instruction to turn it off properly.


Hoping for your help. Thanks.

Best Answer by IanSoliven2
Answered By 0 points N/A #166214

How will I disable sftp?


You might try this.

Place the user’s shell to:


This will give the right path for sftp-server, if it is on the server.

Do it by opening:

/etc/passwd and change the shell field to

Then it will look like this:


next, add:

/usr/libexec/openssh/sftp-server to /etc/shells

This will disable sftp and shell access to user test.

Best Answer
Best Answer
Answered By 0 points N/A #166215

How will I disable sftp?


Disabling SFTP is certainly a good security measure to prevent unauthorized intrusions to your system. 

There are different ways to disable SFTP depending on your specific distro. 

On UBUNTU, a simple way would be to simply comment out the following line in /etc/ssh :

# Subsystem sftp /usr/lib/openssh/sftp-server 

After which, you should restart.

On CENTOS, you have to do the following:

1. Open the following file using any text editor:

# vi /etc/ssh/sshd_config

2. Comment out:

# Subsystem sftp /usr/lib/openssh/sftp-server

3. Save and restart your computer.

I hope this helps!

Login/Register to Answer

Related Questions