首页 > 代码库 > 串口编程时,出现Cannot open /dev/ttyS0 Permission denied解决

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

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

trying to open file "/dev/ttyS0"

could not open file: 权限不够

port open is false

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


解决方法如下:

jgc> id -Gn
pax cdrom floppy audio dip video plugdev netdev bluetooth scanner

jgc> sudo adduser jgc dialout
[sudo] password for jgc: 
Adding user jgc to group dialout
Done.

<< Restart done here to ensure new group picked up >>

jgc> id -Gn
jgc dialout cdrom floppy audio dip video plugdev netdev bluetooth scanner

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