Code change:
When one installs mastodon via the following minimal config: Then there is no obvious way to run tootctl. or any other login user doesn't have the executable by default, nor can this be enabled in an obvious way. is not a login user, so can't (and shouldn't?) log in as and execute . Steps to reproduce the behavior: mastodon as per minimal config above ... nope. ... nope. ... nope. ... nope. Any of: a setting such that is installed for that user an explanation in the docs what to do as a login user (probably bad idea?) Workaround: CC
I think upstream intends only to be run by the mastodon user. My way for doing that is just running and continuing in that shell. The reason why doesn't work is probably because sudo inherits PATH from the user you are coming from? I'm not sure I understand the concept of a login user enough. How would mastodon become a login user and why would that be a bad idea?
In the mastodon docs, it is described the following way: But is not possible, it gives the error They do recommend (which is what I meant by it shouldn't be a login user), but still they seem to do something different than nixos does. Maybe that's fine, and it would be helpful to document this somewhere, so people don't spend a long time trying to find it out.
This is default for almost all service users because they have no login shell. Use ` This is wrong. Sudo resets all path like variables like PATH and PYTHON PATH. Also inheriting needs to be turned on explicitly and PATH mist always ve inherited explicitly. Other services like nextcloud include a wrapper that sudos to the right user. This should be for mastodon, too.
Sounds like a good solution. Then we could make the command globally available.
That isn't? I would have expected that it is very similar to nextcloud-occ.
No currently it is only available to the mastodon user, so tootctl never gets called as the wrong user.
There is a hack in the nixos nextcloud-occ script that automatically sudoes if called by a different user. This could be adapted to tootctl I think.
Yes, this should be adapted. Changing the mastodon to a login user would not be the correct fix.

Related discussion:
text: # Simple check tootctl commands # Check Mastodon version <del> server.succeed("su - mastodon -s /bin/sh -c 'mastodon-env tootctl version' | grep '${pkgs.mastodon.version}'") </del> <ins> server.succeed("mastodon-tootctl version | grep '${pkgs.mastodon.version}'") </ins> # Manage accounts <del> server.succeed("su - mastodon -s /bin/sh -c 'mastodon-env tootctl email_domain_blocks add example.com'") server.succeed("su - mastodon -s /bin/sh -c 'mastodon-env tootctl email_domain_blocks list' | grep 'example.com'") server.fail("su - mastodon -s /bin/sh -c 'mastodon-env tootctl email_domain_blocks list' | grep 'mastodon.local'") server.fail("su - mastodon -s /bin/sh -c 'mastodon-env tootctl accounts create alice --email=alice@example.com'") server.succeed("su - mastodon -s /bin/sh -c 'mastodon-env tootctl email_domain_blocks remove example.com'") server.succeed("su - mastodon -s /bin/sh -c 'mastodon-env tootctl accounts create bob --email=bob@example.com'") server.succeed("su - mastodon -s /bin/sh -c 'mastodon-env tootctl accounts approve bob'") server.succeed("su - mastodon -s /bin/sh -c 'mastodon-env tootctl accounts delete bob'") </del> <ins> server.succeed("mastodon-tootctl email_domain_blocks add example.com") server.succeed("mastodon-tootctl email_domain_blocks list | grep example.com") server.fail("mastodon-tootctl email_domain_blocks list | grep mastodon.local") server.fail("mastodon-tootctl accounts create alice --email=alice@example.com") server.succeed("mastodon-tootctl email_domain_blocks remove example.com") server.succeed("mastodon-tootctl accounts create bob --email=bob@example.com") server.succeed("mastodon-tootctl accounts approve bob") server.succeed("mastodon-tootctl accounts delete bob") </ins> # Manage IP access <del> server.succeed("su - mastodon -s /bin/sh -c 'mastodon-env tootctl ip_blocks add 192.168.0.0/16 --severity=no_access'") server.succeed("su - mastodon -s /bin/sh -c 'mastodon-env tootctl ip_blocks export' | grep '192.168.0.0/16'") server.fail("su - mastodon -s /bin/sh -c 'mastodon-env tootctl ip_blocks export' | grep '172.16.0.0/16'") </del> <ins> server.succeed("mastodon-tootctl ip_blocks add 192.168.0.0/16 --severity=no_access") server.succeed("mastodon-tootctl ip_blocks export | grep 192.168.0.0/16") server.fail("mastodon-tootctl ip_blocks export | grep 172.16.0.0/16") </ins> client.fail("curl --fail https://mastodon.local/about") <del> server.succeed("su - mastodon -s /bin/sh -c 'mastodon-env tootctl ip_blocks remove 192.168.0.0/16'") </del> <ins> server.succeed("mastodon-tootctl ip_blocks remove 192.168.0.0/16") </ins> client.succeed("curl --fail https://mastodon.local/about") server.shutdown()