Hi,
My last forum thread was me asking about the possibility of using HZeller’s library to display visual information regarding the current skill on a matrix display. Since, I’ve done some more research into the matter and have ran into a few roadblocks. I had a few workarounds in mind and wanted to see if anyone could confirm that my ideas are possible.
Python scripts that use HZeller’s library need root permissions according to the Git readme. This is supported by the fact that all examples are ran as sudo. Assuming that Mycroft skills do not automatically run under the ‘root’ user, I figured I must either find a way to launch another script that controls the leds by modifying existing skills to include a sudo command, or find a way to give skills root permissions.
Can I launch another Python program from a skill while retaining full Mycroft functionality? I apologize if this question sounds silly, I’m quite new to Mycroft and programming in general.
I am going to edit the sudoers file to allow the scripts that control the matrix to run with root permissions, and I won’t list my password in plain text.
Normally I would just try this all out myself but I haven’t actually purchased any on the hardware yet. Just trying to plan ahead as much as possible. Thanks in advance for any information.
EDIT: Forgot to mention that I’d be starting the other scripts using os.system(). Any other solutions for running a seperate script with root permissions is appreciated.
It is possible for a Skill to use linux system commands as sudo, but it requires additional setup on the part of the Skill user. The Aircrack Skill by Jon Stratton is a great example of this.
Running another Python program
You can use Python libraries from within your Skill by importing them, and also use Linux system functions by using the relevant library;
import os
os.system('ls')
This would be one way to call another Python script.
Hi, I’m trying to give Aircrack Skill by Jon Stratton a sudo permission. How to do it? The “description” on the linked Github page from Jon Stratton just says “please visudo and grant the user access like the following:
Cmnd_Alias AIRCRACK = /usr/sbin/airmon-ng, /usr/sbin/airodump-ng, /usr/sbin/aireplay-ng, /sbin/iwlist
my_mycroft_user ALL = NOPASSWD: AIRCRACK”
That doesn’t help me at all!! It doesn’t say HOW TO DO IT!
So I tried to figure out what “visudo” means and by typing visudo in the terminal, a file opened and I simply copied and pasted the 2 lines:
“you basically authorized aircrack to not need sudo password, for your use case you need to authorize your own commands”
I want to authorize aircrack to not need sudo password!! Nothing else. Please don’t mix me up with the original author of this post. I added those lines, but still, aircrack has no permission to let the aircrack-skill work!
Can anyone give a simple step-by-step tutorial for me? Which file I have to open or create or alter and where and what I have to type into this file to give permission to the aircrack skill??
Such simple explanation should be added to the Github webpage of the skill itself, instead of just saying “do it” without giving advise or any kind of explanation for newcomers like me. I’m sure it could be explained in 2 sentences or less
if you just copy pasted i think the mistake was the user
my_mycroft_user
needs to be replaced with your user account, in my case it’s “user”, in your’s it will depend on under what you are running it, i.e. “chrispy”, if unsure just check your terminal, when i open mine it looks like this
user@JAntIx:~
where user is my user account, and JAntIx is my hostname
visudo edits the file for you to avoid screw ups, the link i posted above goes into some detail
you are authorizing the following executables used by the skill to not need sudo password ``` /usr/sbin/airmon-ng, /usr/sbin/airodump-ng, /usr/sbin/aireplay-ng, /sbin/iwlist
You can always make a Pull Request to improve the readme, or open an issue so the original author can see it
@JarbasAl:
Thanks for taking your time to explain it to me, I’m sure other users will appreciate it as well
I’m using the standard Picroft image and my username is
So if I understood you correctly, I will do the following
Press CTRL + c (to exit Picrofts “CLI” interface and enter the terminal)
type visudo into the terminal (and a file will open)
add the following lines anywhere(?) into this file (in my case the user name is pi, as I installed it with the official image from mycroft.ai): Cmnd_Alias AIRCRACK = /usr/sbin/airmon-ng, /usr/sbin/airodump-ng, /usr/sbin/aireplay-ng, /sbin/iwlist
pi ALL = NOPASSWD: AIRCRACK
(or do I have to alter Cmnd_Alias as well?)
press CTRL + x (to save the file)
press y (to confirm to save the file)
press ENTER (to get back to the terminal)
type reboot (to reboot the system and getting back to Picroft)