LLI Wiki — My Digital Knowledge Base

sshfs and encrypted MySQL connection to shared hosting

Mount a remote directory with sshfs and connect to MySQL over TLS from Linux.

A few useful commands to administer a website hosted at a shared hosting provider from Linux: mount the remote home directory over SSH and connect to the MySQL database, with or without TLS.

Mount a remote directory with sshfs

sshfs -o idmap=user,allow_other,default_permissions user@example.com:~/ mnt/site
Option Purpose
idmap=user Maps the remote user to the local user
allow_other Lets other local users access the mount
default_permissions Enforces kernel permission checks

The mount point (mnt/site) must exist. To unmount: fusermount -u mnt/site.

Connect to MySQL

Plain connection. With no value after -p, the client prompts for the password:

mysql -D app_db -u app_user -p -h sql.example.com

Encrypted connection, verified against the certificate authority (CA) file supplied by the provider:

mysql --ssl --ssl-ca /path/to/sqlca.pem -D app_db -u app_user -p -h sql.example.com

Notes

Mastodon LLIMastodon SocialFosstodon