sftp_connect: Create a List Object with SFTP Connection Details

View source: R/sftp.R

sftp_connectR Documentation

Create a List Object with SFTP Connection Details

Description

sftp_connect outputs a list which is used as an argument to all other functions of the sftp package. Recommended practice is to store the output as sftp_con since that is the object name all other sftp functions look for by default. IMPORTANT! Your password MUST NOT contain the colon character ("") or the at-sign ("@") since these characters have special use as delimiters in the connection string!

Usage

sftp_connect(
  server = "",
  folder = "",
  username = "",
  password = "",
  protocol = "sftp://",
  port = 22
)

Arguments

server

The SFTP server URL, hostname, or IP address

folder

The path to the folder where you want to operate; can be a single folder name in the SFTP root or a path with subfolders, e.g. dir1/dir2/dir3. Note that directory names are case sensitive. Default is empty string, which takes you to the root folder.

username

The SFTP account username. It is recommended to not store your username in any script, but instead create an snvironment variable and call it using Sys.getenv.

password

The SFTP account password. It is recommended to not store your password in any script, but instead create an environment variable and call it using Sys.getenv. IMPORTANT! Your password MUST NOT contain the colon character (":") or the at-sign ("@") since these characters have special use as delimiters in the connection string!

protocol

Default is "sftp://". You will probably never change this value.

port

Default is "22". You will probably never change this value. Theoretically, an SFTP server could be set up to respond on a port other than the default port 22, but this is rarely the case.

Value

A list of strings which are used by all other sftp_* functions when connecting to an SFTP server.

Author(s)

Theodor Stenevang Klemming

See Also

Other sftp: sftp_changedir(), sftp_delete(), sftp_download(), sftp_listdirs(), sftp_listfiles(), sftp_list(), sftp_makedir(), sftp_removedir(), sftp_rename(), sftp_upload()

Examples


## Not run: 
# Minimal - rely on defaults
sftp_con <- sftp_connect(
  username = Sys.getenv("MY_SFTP_USER"),
  password = Sys.getenv("MY_SFTP_PASS")
)

# Explicit
sftp_con <- sftp_connect(
  server = "mysftp.com",
  folder = "myfolder",
  username = Sys.getenv("MY_SFTP_USER"),
  password = Sys.getenv("MY_SFTP_PASS"),
  protocol = "sftp://",
  port = 22
)

## End(Not run)


jesse-smith/coviData documentation built on Jan. 14, 2023, 11:08 a.m.