树莓派Zero的ttyAMA0使用pi用户访问时拒绝访问(Permission denied)的解决办法(已在Zero上遇到并测试通过)

I'm also guessing that you are using a Pi 3B. On a Pi 3B, "/dev/ttyAMA0" is normally reserved for Bluetooth.

To use the Serial Port on the Pi 3B (or any model of Pi running updated Raspbian Jessie):

Remove the phrase "console=serial0,115200" from the file '/boot/cmdline.txt'. Note that this file must only contain 1 line, do not split the line when editing, or try to add comments. This prevents Linux sending boot messages to the Serial Port.

Add the line "enable_uart=1" to the end of the file '/boot/config.txt'. Ensure that this file does not contain any other commands referring to the uart. This takes care of all the background tasks needed to use the Serial Port on the Pi 3B.

Reboot.

Refer to your Serial Port in code as "/dev/serial0", that's serialZero, not serialOh!

No need to change groups or permissions from the defaults.

翻译:

  • 2
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
当你在操作系统中遇到"Permission denied"错误,这意味着你没有足够的权限执行特定的操作。这通常发生在以下几种情况下: 1. 文件或目录权限不足:你可能没有读取、入或执行特定文件或目录的权限。解决方法是使用chmod命令更改文件或目录的权限,例如使用"chmod 755 filename"将文件的权限更改为755。 2. 用户权限不足:你可能没有足够的权限执行特定操作,例如安装软件或修改系统设置。解决方法是使用管理员权限登录或使用sudo命令来执行需要特权的操作。 3. 文件或目录所属用户/组不匹配:如果文件或目录的所有者是其他用户或组,而你没有相应的权限,你将无法访问或执行它们。解决方法是使用chown命令更改文件或目录的所有者,例如使用"chown username:groupname filename"将文件的所有者更改为指定的用户和组。 4. SELinux或AppArmor限制:某些Linux发行版使用SELinux或AppArmor等安全模块来限制进程的访问权限。如果你遇到"Permission denied"错误,可能是由于这些安全模块的限制。解决方法是修改安全模块的策略,以允许特定操作。 5. 磁盘空间不足:如果磁盘空间不足,你可能无法创建新文件或入数据。解决方法是释放磁盘空间或扩展磁盘容量。 这些是常见的"Permission denied"错误解决办法。如果你遇到特定的问题,请提供更多详细信息,以便我能够给出更具体的建议。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值