CentOS Linux 7: Block File Transfers via SFTP with Thunar 1.6.16
In this article, we will discuss how to block file transfers via SFTP using Thunar 1.6.16 on CentOS Linux 7. This can be useful in situations where you want to prevent users from copying files to or from servers via SFTP, but still allow them to connect to the server.
Prerequisites
Before we begin, it is assumed that you have the following:
- A CentOS Linux 7 system with Thunar 1.6.16 installed.
- An SFTP server configured and running.
- Basic knowledge of Linux command line and file permissions.
Understanding the Problem
By default, Thunar allows users to copy files to and from remote servers via SFTP. However, there may be situations where you want to prevent users from doing so, while still allowing them to connect to the server.
One way to achieve this is by modifying the file permissions on the remote server. By removing the write permission for the user, you can prevent them from copying files to the server. However, this will also prevent them from creating new files or modifying existing ones.
A better solution is to modify the Thunar configuration to block file transfers via SFTP. This can be done without affecting the file permissions on the remote server.
Modifying Thunar Configuration
To block file transfers via SFTP in Thunar, you need to modify the Thunar configuration file. This file is typically located at /home/<username>/.config/thunar/thunar-volman.xml.
Before modifying the file, make a backup copy in case anything goes wrong.
Next, open the file in a text editor and look for the following section:
<action>
<name>sftp</name>
<icon>sftp</icon>
<unique-id>sftp</unique-id>
<stock-id>sftp</stock-id>
<target>sftp://%u</target>
<placeholder>sftp://%u</placeholder>
<description>Connect to a remote server using SFTP</description>
<exec>thunar sftp://%u</exec>
</action>To block file transfers, add the following line inside the <action> tag:
<disable>true</disable>The modified section should look like this:
<action>
<name>sftp</name>
<icon>sftp</icon>
<unique-id>sftp</unique-id>
<stock-id>sftp</stock-id>
<target>sftp://%u</target>
<placeholder>sftp://%u</placeholder>
<description>Connect to a remote server using SFTP</description>
<exec>thunar sftp://%u</exec>
<disable>true</disable>
</action>Save the file and restart Thunar. File transfers via SFTP should now be blocked.
- Blocking file transfers via SFTP in Thunar can be useful in situations where you want to prevent users from copying files to or from servers via SFTP, but still allow them to connect to the server.
- This can be achieved by modifying the Thunar configuration file to disable file transfers via SFTP.
- The modified configuration file should look like this:
<action> <name>sftp</name> <icon>sftp</icon> <unique-id>sftp</unique-id> <stock-id>sftp</stock-id> <target>sftp://%u</target> <placeholder>sftp://%u</placeholder> <description>Connect to a remote server using SFTP</description> <exec>thunar sftp://%u</exec> <disable>true</disable> </action>
References
- Thunar User Manual: https://docs.xfce.org/xfce/thunar/user-manual
- Thunar Configuration File: https://docs.xfce.org/xfce/thunar/configuration-file
- SFTP on CentOS Linux 7: https://www.digitalocean.com/community/tutorials/how-to-set-up-sftp-on-centos-7
Note: This article assumes that the reader has basic knowledge of Linux command line and file permissions. It is not intended as a step-by-step guide, but rather as a reference for those who want to block file transfers via SFTP in Thunar on CentOS Linux 7.