In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use sftp to transfer files / folders in Linux". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to transfer files / folders using sftp in Linux.
Sftp is a secure file transfer protocol and is an ssh built-in protocol, which means that as long as the sshd server is started, sftp can be used without additional installation, and its default port is 22, just like SSH. Sftp ensures the security of transferred files by using encryption / decryption technology, so the transmission efficiency of sftp is lower than that of ordinary FTP, but the security of sftp is higher than that of ftp, so sftp is usually used in scenarios with high security requirements, such as reports, statements and so on.
How to use sFTP to transfer files / folders in Linux
By default, the SFTP protocol establishes a secure connection to a remote server in the same way as the SSH transport protocol. Although user authentication uses passwords similar to the default settings of SSH, it is recommended that you create and use SSH password-less login to simplify and more securely connect to remote hosts.
To connect to a remote sftp server, establish a secure SSH connection and create a SFTP session as follows:
$sftp tecmint@192.168.56.10
After logging in to the remote host, you can run the interactive sFTP command as follows:
Sftp > ls # list directorysftp > pwd # print working directory on remote hostsftp > lpwd # print working directory on local hostsftp > mkdir uploads # create a new directory how to upload folders using sFTP
To upload the entire directory to a remote Linux host, use the put command. However, if the directory name does not exist in the working directory on the remote host, you will receive an error, as shown in the screenshot below.
Therefore, first create a directory with the same name on the remote host, and then upload it from the local host, and the-r parameter allows you to copy subdirectories and subfiles:
Sftp > put-r Tecmint.com-articlessftp > mkdir Tecmint.com-articlessftp > put-r Tecmint.com-articles
To retain the modification time, access time, and the mode of the file being transferred, use the-p flag.
Sftp > put-how to download folders using sFTP for pr Tecmint.com-articles
To download the entire fstools-0.0 folder to the local machine from a remote Linux host, use the get command with the-r flag as follows:
Sftp > get-r fstools-0.0 download directory using sFTP
If the folder has been downloaded, then look at the working directory on this machine.
To exit sFTP shell, enter:
Sftp > bye or sftp > exit
Please note that to prevent users from accessing the entire file system on the remote host, you can use chroot Jail to restrict sFTP users to their home directories for security reasons.
At this point, I believe you have a deeper understanding of "how to use sftp to transfer files / folders in Linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.