OpenSSH SFTP Server is a secure file transfer protocol software. It allows secure file transfer between computers over an encrypted connection. This tutorial will explain how to install OpenSSH SFTP server on macOS using the homebrew package manager.
Before installing OpenSSH SFTP server, please make sure that you have the following prerequisites:
In Terminal, type the following command to update the Homebrew package manager:
brew update
In Terminal, type the following command to install OpenSSH:
brew install openssh
In Terminal, type the following command to generate a new SSH key:
ssh-keygen -t rsa
Follow the prompts to generate a new SSH key. By default, the key will be saved to the ~/.ssh
directory.
In Terminal, type the following command to open the SSH configuration file:
nano ~/.ssh/config
Add the following lines to the file:
Host *
StrictHostKeyChecking no
This will disable strict host key checking.
In Terminal, type the following command to create a new SFTP user:
sudo dscl . -create /Users/sftpuser
sudo dscl . -create /Users/sftpuser UserShell /usr/bin/false
sudo dscl . -create /Users/sftpuser RealName "SFTP User"
sudo dscl . -create /Users/sftpuser UniqueID 550
sudo dscl . -create /Users/sftpuser PrimaryGroupID 20
sudo dscl . -create /Users/sftpuser NFSHomeDirectory /Users/sftpuser
sudo dscl . -create /Users/sftpuser Password "*"
In Terminal, type the following command to open the SSH configuration file:
sudo nano /etc/ssh/sshd_config
Add the following lines to the file:
Match User sftpuser
ChrootDirectory /Users/sftpuser
ForceCommand internal-sftp
AllowTcpForwarding no
This will configure SFTP for the newly created user.
In Terminal, type the following command to start the OpenSSH SFTP server:
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
This tutorial has explained how to install OpenSSH SFTP server on macOS using the Homebrew package manager. By following these steps, you can set up secure file transfer protocol software for file transfer between computers over an encrypted connection.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!