# ri > Net::SFTP

---
type: CommandReference
command: Net::SFTP
mode: ri
section: 
source: rdoc
---

## Quick Reference

- `Net::SFTP.start(host, user, options = {})` — initiate an SFTP session
- `session.dir` — access directory operations on the remote host
- `session.download(remote, local)` — download a file from remote to local
- `session.download!(remote, local)` — forced download (overwrite)
- `session.file` — access file operations on the remote host
- `session.upload!(local, remote)` — forced upload (overwrite)

## Name

Net::SFTP — pure-Ruby module for programmatic interaction with a remote host via the SFTP protocol (Secure File Transfer Protocol, as defined by the Secure Shell Working Group).

## Synopsis

ruby
require 'net/sftp'

Net::SFTP.start('host', 'user', password: 'password') do |sftp|
  sftp.download!('/remote/file', '/local/file')
  sftp.upload!('/local/file', '/remote/file')
end
## Methods

### Class methods

- `start(host, user, options = {})` — initiate a new SFTP session. See [Net::SFTP::Session](http://localhost/phpMan.php/perldoc/Net%3A%3ASFTP%3A%3ASession/markdown) for further documentation.

### Instance methods

- `dir` — access directory operations (e.g., listing, creating, removing)
- `download(remote, local)` — download a file from the remote host to the local filesystem
- `download!(remote, local)` — forced download (overwrites existing local file)
- `file` — access file operations (e.g., open, read, write, delete)
- `upload!(local, remote)` — forced upload (overwrites existing remote file)

## See Also

- [Net::SFTP::Session](http://localhost/phpMan.php/perldoc/Net%3A%3ASFTP%3A%3ASession/markdown) — detailed session documentation
- [Net::SFTP](http://localhost/phpMan.php/perldoc/Net%3A%3ASFTP/markdown) — module homepage