I have a user on my machine that should only run mysql. Is there a way that I can install this user shell in mysql and login using password and username?
I know how to change shell to mysql binary
usermod -s /usr/bin/mysql
This really works, only I can not specify the username / password in the program. Usually user / pw is indicated as
mysql -u $USER -p
I can not provide options for the shell, as in
usermod -s "/usr/bin/mysql -u $USER -p"
Also using a simple shell script as a shell does not work:
#!/bin/sh
So, how can I provide parameters for the program that I use as a shell for the user?
Thanks to Tom Regner, I could find a solution using .my.cnf containing
[client] host=localhost user=$user password=$pass disable-auto-rehash
where mysql is installed in the shell. I would still like to give the password manually, but this is the best I have found.
source share