To use SFTP (SSH File Transfer Protocol) to securely transfer files with a remote server, you can follow these steps:
- Open a terminal or command prompt on your local machine.
2. Connect to the remote server using SFTP. Replace username with your actual username and remote_server with the server’s address or hostname:
sftp username@remote_server
If the server uses a different SSH port (not the default port 22), you can specify it with the -P option followed by the port number.
sftp -P 2222 username@remote_server
5. Enter your password when prompted. If you have set up SSH key-based ChatGPT May 24 Versionauthentication, you may not need to enter a password.
4. Once connected, you will see an sftp> prompt. You can now use various commands to interact with the remote server.
- Use ls to list the files and directories in the current remote directory.
- Use cd to change the remote directory.
- Use pwd to display the current remote directory.
- Use Put to upload a file from your local machine to the remote server.
put local_file
- Replace local_file with the path and name of the file you want to upload.
- Use get to download a file from the remote server to your local machine.
get remote_file
- Replace remote_file with the path and name of the file you want to download.
- Use rm to delete a file on the remote server.
rm remote_file
- Replace remote_file with the path and name of the file you want to delete.
- Use mkdir to create a directory on the remote server.
mkdir remote_directory
- Replace remote_directory with the name of the directory you want to create.
- Use exit to close the SFTP connection and return to the local shell prompt.
5. After you finish transferring files, type exit to close the SFTP session.
By using SFTP, you can securely transfer files between your local machine and the remote server over an encrypted SSH connection.