sftp_connect: Create a list object with SFTP connection details

Description Usage Arguments Value See Also Examples

View source: R/sftp_functions.R

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! Questions? https://github.com/stenevang/sftp

Usage

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

Arguments

server

This is the SFTP server URL or hostname or IP-adress.

folder

This is the path to the folder where you want to operate. The value can be a single folder name in the SFTP root or a path with subfolders, like '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 a System Environment 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 a System 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.

Value

The function returns a list of strings which are used by all other functions in the sftp package when connecting to an SFTP server.

See Also

See listing here: sftp

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 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)

stenevang/sftp documentation built on Oct. 25, 2019, 5:16 a.m.