0

I have the following python code where I am trying to open the device /dev/ttyUSB5 using minicom:

import serial
import os
b1_ser_port_num=5
cmd="/dev/ttyUSB"+str(b1_ser_port_num)
print "We are now accessing the serial port : ",cmd
os.system("sudo minicom -D "+cmd+" -b 115200\n")

The above still throws the password prompt at the terminal when I run it. Before doing the above, I had made sure that I added the user to the sudo group by doing the following:

user4@user-pc-4:~$ sudo gpasswd -a user4 sudo
[sudo] password for user4: 
Adding user user4 to group sudo

I also added the following to /etc/sudoers file to ensure that user4 doesn't get prompted for password in order to get access to the serial port /dev/ttyUSB5 through minicom :

user4 ALL=(ALL) NOPASSWD:/usr/bin/minicom

What is going wrong here? How can I disable the password prompt for a specific program without giving the user a complete privilege? I have a feeling I'm missing some piece of information - either with /etc/sudoers or with /dev/ttyUSB5.

skrowten_hermit
  • 293
  • 2
  • 5
  • 15

0 Answers0