目录

sFTP file manipulation (definition)

Begin by connecting to your Gandi server with the sftp command by providing your username on the server and the server's IP address. For example:

sftp name@123.123.123.123

If you are using Gandi AI, the default login is admin, thus:

sftp admin@123.123.123.123

You will then get a brief message saying that the authenticity of host can't be established. At the following prompt, type 'yes' and then return:

Are you sure you want to continue connecting (yes/no)?

You will then be prompted for your password. Enter it at that time.

Once the connection has been established you will see the following prompt:

sftp>

uploading a file

The put command can be used to request an upload to your Gandi server. There are three things to consider in to an upload command:

- the command put - the location of the file on on your computer - the location of the file on your Gandi server

These three considerations form a single command that has three parts:

put + path on your mac) + path on your Gandi server

If you do not specify a path on your Gandi server it will be sent to the current location.

upload examples

You have a file called index.html that you want to transfer from your Mac to your Gandi server.

First you need to know where the file is on your Mac, and where you want to put it on your Gandi server. Here are some examples:

Example #1:

The file to upload is to be transferred from your current location on your mac to your current location on your Gandi server:

sftp> put index.html

Example #2:

The file to upload is to be transferred from your current location on your mac to a specific folder on your Gandi server:

sftp> put index.html host/domains/ganditools.net/public/www/index.html

In this case, you must specify the location of the file on your Gandi server.

example #3:

The file to upload is to be transferred from a specific place on your Mac to your current location on your Gandi server:

sftp> put website/index.html index.html

In this case, you must specify the location of the file on your Mac.

example #3:

The file to upload is to be transferred from a specific place on your Mac to a specific place on your Gandi server:

sftp> put website/index.html host/domains/ganditools.net/public/www/index.html

In this case, you must specify the location of the file on your Mac and on your Gandi server.

download examples

Downloading files is the same, only the command 'get' is used, and the order is inverted. This the command structure is:

get + remote location (your Gandi server) + local location (your Mac)

Other commands

Below is a list of commonly-used sftp commands (a complete list and description is available in the UNIX man sftp document).

Note: Only the word in bold is the command. If you have questions regarding the use of these commands, please refer to online or printed documentaion. To see full list of options that can be applied to each command, refer to the UNIX man documentation for the command (type man + the command in your terminal, or in a search engine).

Command Action
bye, exit, or quit Quits sftp
cd path Changes the path on your Gandi server to path
lcd path Changes the path on your computer to path
chmod mode path Changes the permissions of the specified file path to the mode you specify
chown own path Changes owner of file path to own. own must be a numeric UID.
get Gandi-path (yourcompuer-path) Downloads files from your Gandi server to your computer (see examples above)
help, or ? Shows the help text
lls (path) Shows the current directory on your computer, or the path if you specify it
lmkdir path Creates a new directory at a specificed location
ls (path] Shows the current directory on your Gandi server, or the path if you specify it
mkdir path Creates a directory on your Gandi server at a given path
put yourcomputer-path (Gandi-path) Uploads a file from your computer to your Gandi server (see examples above)
pwd Shows the working directory on your Gandi server
rename oldpath newpath Renames a file on your Gandi server from the old path to a new path
rmdir path Deletes a directory on your Gandi server at a given path
rm path Deletes a file on your Gandi server at a given path