SSH and SFTP
Reveal and rotate your SFTP and SSH credentials, add SSH keys, restrict access by IP, and add extra SFTP accounts with their own folders.
Every environment has one primary SFTP and SSH user. Open your site, then Info, to see the host, port, and username under Primary SFTP and SSH user, reveal the password, add keys, and restrict who can connect. Each environment has its own credentials, and the page names the environment they belong to. The SSH port is a number from 22001 to 25999, not 22, so copy it from Info.
Reveal the credentials
- Open your site, then Info.
- Under Primary SFTP and SSH user, choose to show the password.
- Enter your account password again.
WP Waterfall asks for your account password before it shows a secret, and it hides the secret after a minute. The reveal is session only: it is never stored in your browser. Every reveal is audited and shows on the User activity tab with your name. Copy the password from here, or rotate it.
Rotate the credentials
Choose to rotate the password when you think it leaked or when someone who had it leaves. WP Waterfall sets a new password through a job. Anything that used the old password stops working until you update it.
Connect
The connection commands for SSH and SFTP are ready to copy. You can also download the FTP client config file and import it into your client.
An SFTP session and an SSH sign-in start in the site's folder, /var/www/html, and cd ~ takes you to your home folder.
After an SSH sign-in you see the WP Waterfall name, then the site and the environment you are on, such as my-site (staging), so you always know which one a terminal is connected to. A Git push, an SFTP session, and a command run over SSH print nothing extra.
Add an SSH key
Add your public key to sign in without a password. Remove a key when you no longer use that computer. Each change applies through a job. Adding a key asks for your password if you have not entered it in the last 10 minutes.
Keys added here belong to this one environment. For Git, add your key once to your account instead: it works on every staging and preview environment you may push code to. See How do I add an SSH key to my account?. While a repository is connected to the environment, SFTP and SSH users on Info are off. The API refuses new SFTP users, turning SFTP on, and the SFTP credentials with 409 external_repository_connected, and a job queued earlier ends before it reaches the server. Disconnect the repository to get SFTP back.
SSH settings
Edit the authentication methods and the password expiration. Allow keys only to stop password sign-in, or keep both. Set an expiration so passwords must be rotated.
A change that opens SSH up asks for your password if you have not entered it in the last 10 minutes: turning SSH on, turning password sign-in on, and an allowed address list that lets in a new address or is emptied. Turning something off or narrowing the list asks for nothing.
Restrict by IP
Edit the IP allowlist to limit SSH and SFTP to the addresses you choose, such as your office. When the list is empty, every address can try to connect. The list applies through a job. Five failed logins from one address within ten minutes block that address for an hour. This also stops Git over SSH from that address.
Extra SFTP accounts
Additional SFTP users each get one folder. Use them to give a contractor access to one theme folder without the rest of the site, or, on live, to let a person download the live files and add media to the uploads folder. Every environment takes them, live included.
- Open Info and find Additional SFTP users.
- Choose Add new user.
- Enter a Username: 3 to 32 lowercase letters, digits, hyphens, or underscores.
- Check the Password. WP Waterfall makes one in your browser and shows it. Choose the eye to hide it, the arrows for a new one, and the copy icon to copy it. You can type your own: use 16 to 32 characters, with no spaces or colons.
- Set the Root directory. The web root,
/var/www/html/, is fixed. Type a subdirectory after it, such aswp-content/themes/agency, or leave it empty for the whole site. The user sees only that folder. WP Waterfall makes the folder when it is missing. - Pick the Access. On staging or a preview in SFTP mode: Read, write or Read only. On live, and on staging or a preview in Git mode: Read, and upload to the uploads folder or Read only.
- Choose Add new user. The dashboard asks for your account password first, because a new user comes with a password.
The password you chose is not shown again. Reveal it later the same way as the primary credentials, with your account password. Remove a user you no longer need from its row menu.
Live and Git mode: read, and upload to the uploads folder
Live code is read only, and so is code in Git mode on staging and previews. Nobody can write a code file there. A user is one of two kinds:
- Read, and upload to the uploads folder sees and downloads every file of the site. It can also add files and folders to
wp-content/uploads, replace them, rename them, and delete them. That is the folder WordPress keeps your media in, and it is content, not code. The user cannot change anything else: not themes, plugins,mu-plugins,wp-config.php, or the cache folder. It cannot make links either. The dialog starts with this choice. - Read only sees and downloads files and changes nothing.
A user who uploads needs the Root directory to be the whole site or wp-content, so it can reach the uploads folder. A folder inside wp-content/uploads does not work for any user on live: the server cannot confine a user to a folder the web user owns, and the user may be unable to sign in.
Uploaded code does not run. PHP files in the uploads folder, such as .php, .phtml, and .phar, answer 403 and never reach PHP, and .htaccess and .user.ini files are never served and change nothing. The SFTP server cannot refuse a file by its name, so the web server is what keeps those files inert. PHP also refuses to run any script whose real path is in the uploads or cache folder, even when a link or the web root would lead there, and WP Waterfall refuses a web root of wp-content or of a folder inside uploads or cache.
An uploaded page does not run as part of your site either. A file that opens as a page in a browser (HTML, SVG, XML, and the like) is served from uploads with a Content-Security-Policy: default-src 'none'; sandbox header, so a script in it cannot read your site or act as a signed-in visitor. Images, video, audio, and PDF files are not affected, and an SVG you use as an image on a page still shows. Opening an uploaded SVG or HTML file on its own shows it without scripts and without its own styles.
When you switch a user off or remove it, or switch SFTP off, every session that user has open ends at once. Removing a user also deletes its password from the server, so a new user with the same name starts with a new password.
Make code changes on staging and promote them. Switch staging or a preview to SFTP mode to give a user Read, write. In SFTP mode that covers your own must-use plugins in wp-content/mu-plugins too. The two WP Waterfall entries there, wpwaterfall.php and the wpwaterfall folder, stay read only for every user (see Your own must-use plugins). See Git access. A user keeps the access it was made with: one made as Read, and upload to the uploads folder only reads while its environment is in SFTP mode, and uploads again when the environment goes back to Git mode. To change a user's access, remove the user and add it again.
Accounts made on live before the upload choice exist stay Read only, with the password they had. Nothing changes for them until you remove and add them again.
What the folder check does
Before the user exists, the server checks the folder. It must be below the web root with no ... A link in the site that leads out of the site is refused. A missing folder is made, except where code is read only (live, Git mode): there the job fails and says to make the folder on staging and promote. If the server may refuse the user's sign in because of who owns the folder, the job shows a warning and still succeeds.
The Enable all and Disable all button is gone from the dashboard. Turn SFTP and SSH off for the whole environment with Disable on Primary SFTP and SSH user. The API route PUT /v1/environments/{id}/sftp-accounts/status and the manage_sftp_accounts actions enable_all and disable_all still switch the extra users on or off.
Quick answers
I rotated the password and my deploy script broke. Update the script with the new password, or switch it to an SSH key.
Can a Site Developer reveal credentials? No. Only a Site Admin can reveal credentials or manage SSH on the site. See Give someone access to one site.
API
GET /v1/environments/{id}/credentials/sftpPOST /v1/environments/{id}/credentials/rotateGET /v1/environments/{id}/sshPATCH /v1/environments/{id}/sshGET /v1/environments/{id}/ssh/allowed-ipsPUT /v1/environments/{id}/ssh/allowed-ipsGET /v1/environments/{id}/ssh/config(thehost_key_fingerprintis null until the server reports it)GET /v1/environments/{id}/local-devPOST /v1/environments/{id}/ssh-keysDELETE /v1/environments/{id}/ssh-keys/{key_id}GET /v1/environments/{id}/sftp-accountsPOST /v1/environments/{id}/sftp-accounts(username,directory, and the optionalpasswordof 16 to 32 characters andaccessofread_write,read_only, orread_upload;read_uploadneeds read only code and a directory of/or/wp-content, and answers 409agent_too_olduntil the server has the upload update)PUT /v1/environments/{id}/sftp-accounts/statusDELETE /v1/sftp-accounts/{id}
Related
Still stuck?
Email support at wpwaterfall dot com with your site name and what you tried, or send us a message.