title: Restarting the video assistant with a simple command
body: <p>Original problem: on my MacBook Pro, the video camera keeps freezing. Found <a href="https://www.macobserver.com/tmo/article/having-problems-with-your-macs-facetime-camera-heres-a-fix" rel="nofollow noreferrer">the solution is to type</a> </p>
  
  <pre><code>sudo killall VDCAssistant
  </code></pre>
  
  <p>in a terminal, and provide my password (I have admin privileges).</p>
  
  <p>Now I would like to make this a single command (that doesn't need a password). I found that it is possible to use <code>visudo</code> to edit a file that tells <code>sudo</code> what commands might be run without requiring a password. Obviously it would be too dangerous to make <code>killall</code> itself "password free", so I was hoping I could wrap the specific command inside another script; make that script "password free"; and get on with my life. So here is what I did:</p>
  
  <p>Create a file called <code>video</code>, which contains</p>
  
  <pre><code>!#/bin/bash
  sudo killall VDCAssistant
  </code></pre>
  
  <p>Put it in <code>/usr/local/bin</code>, give permissions <code>chmod 700 video</code>, and rehash. When I type <code>video</code>, I get prompted for my password. So far so good.</p>
  
  <p>Next, I ran <code>visudo</code> and added the lines</p>
  
  <pre><code>User_Alias USERS = myusername
  CMND_Alias CMDS = /usr/local/bin/video
  USERS ALL = (ALL) NOPASSWD: CMDS
  </code></pre>
  
  <p>But that doesn't have the desired effect. I am still prompted for the password. If I make <code>root</code> the owner of the script, it doesn't change things. If I leave out the <code>sudo</code> part of the command, it tells me "No matching processes belonging to you were found".</p>
  
  <p>Does anyone have a trick that I missed - how do I achieve my goal (using a single-word command to perform the <code>killall</code> for a process I do not own, without having to type my password)?</p>
  
  <p>I have read the answers to <a href="https://stackoverflow.com/q/6905697/1967396">how to run script as another user without password</a> but could not find anything that applied here; I also read the answers to <a href="https://superuser.com/q/67765/196531">sudo with password in one command line</a> - that is where the inspiration to use <code>visudo</code> came from - but again it didn't give me the answer I was looking for. Obviously I can't save my password in plain text, and I don't want to remove the "normal" protections from <code>killall</code>.</p>
  
  <p>Is there a way to do this?</p>