King Zone - sftp
type: channel
link: https://www.kingtam.win/tag/sftp/
items: Securely Transfer Files Over The Network

Securely Transfer Files Over The Network
type: item
date: 2023-07-26T08:25:00+08:00
description: Securely Transfer Files Over The Networksftp-scp.jpgSecure File Transfer Protocol (SFTP)SFTP, or Secure File Transfer Protocol, is a network protocol that provides file access, file transfer, and file management functionalities over any reliable data stream. It is typically used with the SSH protocol to provide secure file transfer, but it can be used with other protocols as well.Use SFTP:sftp username@remote-hostThis command will initiate an SFTP session with the remote-host. It will be prompted to enter the password for the username connecting with.Once in the SFTP session, we can use ls to list files, cd to change directories, get to download files, and put to upload files. Here are syntax for reference:Server ActionsCommand SyntaxChange directorycd /etc/test or cd PATHList filesls dirCreate directorymkdir directoryDelete directoryrmdir directoryShow current directorypwdChange groupchgrp groupname PATHChange ownerchown username PATHChange permissionschmod 644 PATH (where 644 is an example of permissions)Create linkln oldname newnameDelete file or directoryrm PATHRename file or directoryrename oldname newnameExit serverexit, bye, or quitClient ActionsCommand SyntaxChange local directorylcd PATHList local filesllsCreate local directorylmkdir directoryShow current local directorylpwdUpload file to serverput [local directory or file] [remote]Download file from serverget [remote host directory or file] [local machine]Wildcards supportedUse * or *.rpm in file names for uploading/downloading multiple filesSecure Copy Protocol (SCP)Secure Copy Protocol (SCP) is a means of securely transferring computer files between a local and a remote host or between two remote hosts. It uses SSH for data transfer and provides the same authentication and security as SSH.i. (push file) The example of using SCP to transfer files:scp "/path/to/localFile" username@remote-host:/path/to/remoteDirectoryThis command will copy the file localFile from local machine to the remoteDirectory on the …