Using sudo without password on Linux to start kanata, and only kanata #928
idoric
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
sudo visudo -f /etc/sudoers.d/kanata
YourLogingUser ALL=(ALL) NOPASSWD: /path/to/kanata
to your needs and save this single lineNow
sudo /path/to/kanata --cfg ~/path/to/config.kbd
will be executed without ever asking for a password.sudo /path/to/kanata --cfg ~/path/to/config.kbd >/dev/null &
.Important warning: I strongly advise you to first create a backup account with administrator rights, and if you use this feature, to deactivate automatic connection to your account at startup. Also, if you forget the & at the end of the line, your session will be stuck without ever finishing starting, in which case remember that it's possible to exit Kanata with lctl+spc+esc.
I needed to start Kanata at user level (shared computer), but without giving my user account access to the /dev/input/* files (you have the right to think I'm paranoid). I can't get both simultaneously with systemd (#130), and creating a special account to run Kanata would still require the trick above (the technique of assigning a wrong shell and then using su --shell is no longer functional by default precisely for security reasons). And ultimately this is the simplest solution I found.
This solution is satisfactory for me, but it would be possible to do better:
YourLogingUser ALL=(kanata) NOPASSWD: /path/to/kanata
andsudo -u kanata /path/to/kanata --cfg ~/path/to/config.kbd >/dev/null &
. (You can even lock that account with the commandusermod -L kanata
)Beta Was this translation helpful? Give feedback.
All reactions