> For the complete documentation index, see [llms.txt](https://docs.linuxgsm.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.linuxgsm.com/linux/ftp-scp.md).

# ftp-scp

SFTP (Secure File Transfer Protocol) is the transfer protocol to view and transfer files over SSH. SFTP works the same as FTP but is encrypted.

## SFTP Advantages

* Encrypted
* Nothing extra to install (such as FTP server)
* Works like any other FTP server
* Compatible with the popular clients such as Filezilla and WinSCP
* You can login to any SSH accessable Linux user.

## How to use SFTP

* Connect like any FTP except it uses the port (default 22)
* Use your linux username / password
* You might need to set protocol to SFTP in your FTP client.

## Bad practice to avoid

### By all means, you should **never**

1. Connect to a server as root.
2. Use FTP if SFTP is available.

#### Root login to an FTP

Here is why you shouldn't

* By logging in as root, you might accidentally remove essential system files or put useless files into the wrong place and mess up with your system.
* But even more annoying, any file you'll write will belong to root, and the user won't be able to either read, change, or execute writtent files as root.
* FTP is an unencrypted protocol, therefore it is very unsecure to edit sensitive files using it.

**How to operate without root FTP login ?**

* If you need to edit system config files, then do like everyone else : use an SSH text editor like "nano" or "vi".
* Set your FTP so that you can login as users with a valid shell from the machine. Eventually, disable root FTP login.
* Oh, one more thing... Did we talk about SFTP ?


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.linuxgsm.com/linux/ftp-scp.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
