Last active
October 14, 2019 17:40
-
-
Save xeoncross/358d7f06f5c22e6382a7bb4e97a58dfc to your computer and use it in GitHub Desktop.
Simple SSH user for read-only access to MySQL. Note, they still have a home directory and full SSH access so this assumes you trust them and/or need them to have access to other system features.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create the SSH/system user | |
useradd dbreports | |
mkdir -p /home/dbreports/.ssh | |
chown -R dbreports:dbreports /home/dbreports/ | |
chmod 700 /home/dbreports/.ssh | |
# Add the SSH keys | |
vim /home/dbreports/.ssh/authorized_keys | |
chmod 644 .ssh/authorized_keys | |
# Add this user to | |
mysql | |
> GRANT SELECT ON *.* TO 'dbreports'@'localhost' IDENTIFIED BY 'passwordhere'; | |
> flush privileges; | |
> quit; | |
# You might want to replace `localhost` with `%` depending on access | |
# Test it out | |
mysql -u dbreports -p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Setup MySQL on Ubuntu