What is SFTP?
Secure File Transfer Protocol (Secure File Transfer Protocel) is an encrypted file transfer protocol designed as an extended version of SSH by the Internet Engineering Task Force. SFTP transfers files via SSH. FTP is a non-encrypted file transfer protocol, which has security risks.
Modify the default directory for root user login sftp
Set the root user's directory to "/srv/ftp" by modifying the "/etc/ssh/sshd_config" file.
Step 1: Create an ftp folder and set the permissions of the ftp folder to 755
mkdir /srv/ftp
chmod 755 /srv/ftp
Step 2: Modify the sshd configuration file
sudo vi /etc/ssh/sshd_config //通过vi命令打开配置文件
Modify the content of the sshd configuration file as follows:
Subsystem sftp internal-sftp
Match User root
ChrootDirectory /srv/ftp
ForceCommand internal-sftp
AllowTcpForwarding no
X11Forwarding no
Exit and save.
Step 3: Restart sshd and try to log in remotely
sudo service sshd restart
Remote access from client computer:
sftp root@192.168.56.101
The remote sftp login on the windows platform is as follows: The
directory information corresponding to linux is as follows: