Adding ssh and/or sudo to a Mac daemon user account, or adding an existing Mac user account to the daemon group.
Budget: €36 – €0 EUR
This is part of a problem that I am trying to solve for some time now: Need to run SQL queries against a MariaDB database on a remote machine from within FileMaker server (on a Mac). For that I need ssh and/or sudo for the FileMaker server user.
As a sidenote: ODBC works with FileMaker server, but it is far too slow and not really useable. Furthermore FileMaker’s SQL is somewhat limited. I'd like to directly query the remote data base.
What I need works perfectly fine in bash: Mac Terminal => ssh into remote machine => Query MariaDB data base.
It also works fine using a FileMaker client: FileMaker client => bBox Plugin => shell command ssh => Query MariaDB data base.
However, it doesn't work on FileMaker server! The reason is that FileMaker server runs on a special user account «fmserver» and its in the daemon group with no interactive shell and no ssh.
My first approach:
The following works: FileMaker server => bBox plugin => shell commands.
But ssh won’t work. And sudo doesn't work, even though I added fmserver to the sudoers file.
Second approach:
FileMaker server can be installed for a different user, but this user needs to be in the daemons group. I don't know how to do that, and most importantly I don't know if there are any drawbacks when I add a normal Mac user to the daemon group.
These are the two possibilities that I see. If you know what you’re doing you could find a solution for approach 1 (enabling sudo or adding ssh for the fmserver account), or a solution for approach 2 (adding an existing user to the daemon group with no negative side effects, or creating a new user account that is in the daemon group and has either sudo (preferred) or ssh capabilties). Or maybe you have an idea for a third solution?
Please — when you respond — please include some proof that you are the right person who can solve this puzzle. A piece of shell script or a link to a stack exchange (or similar) topic that you wrote.
I’m having these kind of questions regularly around the topis Mac OS, bash, FileMaker, SQL. Maybe we can work together long term.
Examples:
<Code>
mac:~ admin$ whoami
admin
mac:~ admin$ echo -n "password" | sudo -S -u fmserver -s whoami
fmserver
mac:~ admin$ sudo -su fmserver
bash-3.2$ whoami
fmserver
bash-3.2$ sudo -u admin -s whoami
admin
bash-3.2$ whoami
fmserver
bash-3.2$ echo -n "password" | sudo -S -u admin -s whoami
admin
bash-3.2$ echo -n "password" | sudo -S -u admin -s ssh root@10.10.10.10 "mysql -uroot -ppassword -e 'USE mydb; SHOW TABLES;'"
Tables_in_mydb
...
</Code>
When I issue the exact same commands using bBox on FMS, I get the following results:
<Code>
bBox_Shell ( 0 ; "whoami")
fmserver
bBox_Shell ( 0 ; "echo -n \"password\" | sudo -S -u admin -s whoami")
?
</Code>
As a sidenote: ODBC works with FileMaker server, but it is far too slow and not really useable. Furthermore FileMaker’s SQL is somewhat limited. I'd like to directly query the remote data base.
What I need works perfectly fine in bash: Mac Terminal => ssh into remote machine => Query MariaDB data base.
It also works fine using a FileMaker client: FileMaker client => bBox Plugin => shell command ssh => Query MariaDB data base.
However, it doesn't work on FileMaker server! The reason is that FileMaker server runs on a special user account «fmserver» and its in the daemon group with no interactive shell and no ssh.
My first approach:
The following works: FileMaker server => bBox plugin => shell commands.
But ssh won’t work. And sudo doesn't work, even though I added fmserver to the sudoers file.
Second approach:
FileMaker server can be installed for a different user, but this user needs to be in the daemons group. I don't know how to do that, and most importantly I don't know if there are any drawbacks when I add a normal Mac user to the daemon group.
These are the two possibilities that I see. If you know what you’re doing you could find a solution for approach 1 (enabling sudo or adding ssh for the fmserver account), or a solution for approach 2 (adding an existing user to the daemon group with no negative side effects, or creating a new user account that is in the daemon group and has either sudo (preferred) or ssh capabilties). Or maybe you have an idea for a third solution?
Please — when you respond — please include some proof that you are the right person who can solve this puzzle. A piece of shell script or a link to a stack exchange (or similar) topic that you wrote.
I’m having these kind of questions regularly around the topis Mac OS, bash, FileMaker, SQL. Maybe we can work together long term.
Examples:
<Code>
mac:~ admin$ whoami
admin
mac:~ admin$ echo -n "password" | sudo -S -u fmserver -s whoami
fmserver
mac:~ admin$ sudo -su fmserver
bash-3.2$ whoami
fmserver
bash-3.2$ sudo -u admin -s whoami
admin
bash-3.2$ whoami
fmserver
bash-3.2$ echo -n "password" | sudo -S -u admin -s whoami
admin
bash-3.2$ echo -n "password" | sudo -S -u admin -s ssh root@10.10.10.10 "mysql -uroot -ppassword -e 'USE mydb; SHOW TABLES;'"
Tables_in_mydb
...
</Code>
When I issue the exact same commands using bBox on FMS, I get the following results:
<Code>
bBox_Shell ( 0 ; "whoami")
fmserver
bBox_Shell ( 0 ; "echo -n \"password\" | sudo -S -u admin -s whoami")
?
</Code>