串口编程时,出现Cannot open /dev/ttyS0 Permission denied解决

时间:2021-04-27 09:31:57

    在ubuntu14.04上,通过qt creator进行串口编程时出现:

trying to open file "/dev/ttyS0"

could not open file: 权限不够

port open is false

jgc> ls -al /dev/ttyS0crw-rw---- 1 root dialout 4, 64 Mar 23 21:00 /dev/ttyS0
jgc> echo xyzzy >/dev/ttyS0
bash: /dev/ttyS0: Permission denied


解决方法如下:

jgc> id -Gnpax cdrom floppy audio dip video plugdev netdev bluetooth scannerjgc> sudo adduser jgc dialout[sudo] password for jgc: Adding user jgc to group dialoutDone.<< Restart done here to ensure new group picked up >>jgc> id -Gnjgc dialout cdrom floppy audio dip video plugdev netdev bluetooth scanner

本文出自 “sky-moon” 博客,请务必保留此出处http://248341.blog.51cto.com/238341/1439044