Reference
Commands
sudo sftpgatewaysetup
: Initial setup for SFTP Gatewaysudo sftpgatewaysetup --bucket your-s3-bucket-name
: Specify the name of your default bucketsudo addsftpuser <user>
: Creates and configures a usersudo deletesftpuser <username>
: Deletes a usersudo sftpgw update
: Updates to the latest versionsudo sftpgw reset <user>
: Resets a usersudo sftpgw version
: Shows the version
Linux command line SFTP client
ssh -i <private.key> ec2-user@<IP address>
: login to EC2 instancesftp -i <private.key> <user>@<IP address>
: login to SFTP Gateway clientls
: remote directory listingcd <directory>
: remote change directorypwd
: remote print current directoryput
: upload file from current local directory to current remote directorylls
: local directory listinglcd <directory>
: local change directorylpwd
: local print current directory
Troubleshooting reference
sudo incrontab -l
: Outputs list of directories that upload to S3sudo df -h
: Available disk space on the EC2 instance/home/<user>/.ssh/authorized_keys
: Public keys for authorized SFTP usersssh-keygen -t rsa -C test.key -f test.key -q -N ""
: Generates a public and private key/etc/init.d/incrond restart
: Restarts the incrond service
Paths
Paths accessible to the SFTP user
/home/<user>/home/<user>/downloads/
: S3 download files sync to this directory/home/<user>/home/<user>/local/
: Writeable by SFTP user. Files in this location remain local to the server./home/<user>/home/<user>/shared/
: S3 shared files sync to this directory/home/<user>/home/<user>/uploads/
: Writeable by the SFTP user. Forwards files to S3.
Properties files
/home/ec2-user/.sftpgateway/sftpgateway.properties
: Contains global properties/home/<user>/.sftpgateway/user.properties
: Contains user specific properties/home/ec2-user/.sftpgateway/sftpgateway.sync
: Configures shared download location
Logs
/var/log/movetos3/movetos3.log
: Logs file uploads to S3/var/log/movetos3/s3sync.log
: Logs download sync activity/var/log/secure
: Logs SFTP logins and failures
User SSH keys
/opt/sftpgw/keys
: Keys are stashed here, in case the email doesn't go through/home/user/home/user/.ssh/authorized_keys
: Public keys are appended to this file for user authentication
Using SSE-C for decrypting private downloads
/home/<user>/.sftpgateway/user.properties
: Sets encryption options/home/<user>/.sftpgateway/sse-sync.key
: Custom encryption key location
Using SSE-C for decrypting shared downloads
/root/.sftpgateway/user.properties
: Sets encryption options/root/.sftpgateway/sse-sync.key
: Custom encryption key location
S3 Paths
s3://sftpgateway-i-0123456789abcde/<user>/uploads/
: Upload directorys3://sftpgateway-i-0123456789abcde/<user>/downloads/
: Private download directorys3://sftpgateway-i-0123456789abcde/shared/
: Shared download directorys3://custom-bucket/<user>/uploads/
: Custom upload directorys3://custom-bucket/<user>/downloads/
: Custom private download directory
Global Properties
Global properties are stored here: /home/ec2-user/.sftpgateway/sftpgateway.properties
sftpgateway.bucketname
: The default S3 bucket to save files. Maybe be overridden on a per user basissftpgateway.region
: The S3 region to use. Defaults to the region of the EC2 instancesftpgateway.uploaddir
: The default user upload dir to monitor for incoming files. Defaults touploads
sftpgateway.downloaddir
: The default user download dir to sync from S3. Defaults todownloads
.sftpgateway.rootsharedir
: The local shared directory for shared downloads. Defaults to/opt/sftpgw/shared/
sftpgateway.s3sharedir
: The S3 location for storing shared downloads. Defaults tos3://<bucketname>/shared/
sftpgateway.singlethread
: Property that controls whethermovetos3
calls will run sequentially to conserve memory and network bandwidth. May be needed for instances that receive many small files all at once. Defaults toyes
. Set this tono
to disable.sftpgateway.md5check
: Determines whether to perform a md5 check prior to uploading files to S3. See this page.sftpgateway.fileexclusions
: Ignore files with a specific file extension. See this page for more details.
User Specific Properties
User Specific Properties are stored here: /home/<user>/.sftpgateway/user.properties
s3.uploadpath
- Overriden S3 storage location for a single user. Must be in the format ofs3://<bucketname>/<path>/
. Ifis omitted, it will store files in the root of the S3 bucket. sse.option
- Integer that identifies SSE Option. Valid options include:1
S3 Managed SSE (SSE-S3)2
AWS KMS Managed SSE (SSE-KMS)3
SSE with Customer Provided Keys (SSE-C). The AES 256 key must be stored as binary in a file called/home/<user>/.sftpgateway/sse.key
4
No encyrption
sse.id
- The ARN of the AWS KMS key. Ifsse.option
is2
, this field is required.sse.sync.option
- The SSE option to use for downloads from S3 to SFTP. This property is not created by default. It must be added if the files to be downloaded from S3 are encrypted. See sse.option for acceptable values. If sse.sync.option is3
, the AES 256 key must be stored as binary in a file called/home/<user>/.sftpgateway/sse-sync.key
sse.sync.id
- The KMS ARN for downloads form S3 to SFTP. This property is required ifsse.sync.option
is2
. This property is not created by default. It must be added if the files to be downloaded from S3 are encrypted.