大网数据广告活动
服务器运维问答

Program file exists in /usr/bin, but cannot be used

· 52CE 我爱测

Clearly my file exists in /usr/bin $ ls /usr/bin/ngrok /usr/bin/ngrok However, when I attempt to chown it I receive an error $ sudo chown my_user:users /usr/bin/ngrok chown: cannot dereference '/usr/bin/ngrok': No such file or di…

问题原文

原帖链接 · Jorik · CC BY-SA 3.0

Clearly my file exists in /usr/bin

$ ls /usr/bin/ngrok
/usr/bin/ngrok

However, when I attempt to chown it I receive an error

$ sudo chown my_user:users /usr/bin/ngrok
chown: cannot dereference '/usr/bin/ngrok': No such file or directory

Further attempts to run it also fail!

$ ngrok
bash: ngrok: command not found
$ sudo /usr/bin/ngrok
sudo: /usr/bin/ngrok: command not found

What is happening here?

社区高分解答

原帖链接 · muru · CC BY-SA 3.0

Given the chown error, the most likely possibility is that it's a symlink, as answered by Sven. However, just for reference in case somebody ends up here for cases where the file exists and is not a link, but gives a command-not-found/file-not-found error, one more possibility is that the executable is dynamically linked and for some reason it's not able to load libraries:

  • missing library (run ldd on the binary to see those)
  • missing loader
  • apparmor denying access to a library or loader
  • ...

Also, for a script, if the interpreter in the shebang could not be executed for similar reasons, you'd get the same error.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-02-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。