I need to let a user create mysql dumps, but I want to restrict anything else. I have to do this via ssh into the server, since the mysql server is only listening on internal ip addresses, preventing me from accessing the mysql server directly.
I've tried to jail the ssh user, but that didn't quite work since it couldn't connect to the database over the mysql socket, even if I copied the socket directory into the jail.
Then I read something about /sbin/nologin
allowing the user to authenticate without starting a shell. I though maybe I somehow could pass the command to create the dump / tunnel something straight to the mysql.
Does anyone have any experience allowing a user to create database dumps via ssh, but restricting anything else?
The user could also use a tool like Sequel Pro / MySQL Workbench to connect, but they'd still need to go via ssh, because the database server is otherwise inaccesible.
And they would need to download the dump, but I can make the dump accessible over SFTP.
/etc/passwd
? I could run something in.profile
, then maybe terminate the session afterwards. – ptf Mar 09 '17 at 13:25