美文网首页
执行sudo命令时command not found的解决办法

执行sudo命令时command not found的解决办法

作者: A徐亮波KingA | 来源:发表于2020-07-05 16:21 被阅读0次

https://stackoverflow.com/questions/23714097/sudo-chown-command-not-found

export PATH="$PATH:/usr/sbin"

sudo & chown command not found?

Ask Question

Asked <time itemprop="dateCreated" datetime="2014-05-17T17:16:44" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-size: 13px; vertical-align: baseline; box-sizing: inherit;">6 years, 4 months ago</time>

Active 6 years, 4 months ago

Viewed 14k times

11

2

I have a rails project which I think has been created as root. I want to change the permissions so that the owner is not root but my user.

I found a command here on stackoverflow to achieve this.

sudo chown -R $(username):$(username) Directoryname

So to change it so that my user owns it I am running this:

sudo chown -R $(Jack):$(Jack) APIClient

However I get the error:

 sudo: chown: command not found

If i just run chown without sudo I get:

zsh: command not found: chown

Does anyone have any idea how I can fix this? I think it may be to do with my zsh but not sure.

Thanks for any help.

ruby-on-rails command-line terminal

share improve this question follow

edited May 17 '14 at 18:40

asked May 17 '14 at 17:16

image

jckly

74311 gold badge88 silver badges2020 bronze badges

show 3 more comments

1 Answer

ActiveOldestVotes

18

So @kaman helped me fix the problem in the comments above.

Turns out I didn't have the links to chown in my $PATH variable.

To fix this I added the following to my .zshrc file. However as kaman has put in the comments above If you're running bash just put it in the .bash_profile

export PATH="$PATH:/usr/sbin"

Thanks kaman and hope this helps anyone else who gets the same error.

share improve this answer follow

answered May 17 '14 at 19:40

image

jckly

74311 gold badge88 silver badges2020 bronze badges

相关文章

网友评论

      本文标题:执行sudo命令时command not found的解决办法

      本文链接:https://www.haomeiwen.com/subject/hdmvqktx.html