Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sudo & chown command not found?

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.

like image 774
jckly Avatar asked May 17 '14 17:05

jckly


People also ask

What do sudo mean?

Sudo (superuser do) is a utility for UNIX- and Linux-based systems that provides an efficient way to give specific users permission to use specific system commands at the root (most powerful) level of the system.

What does sudo option do?

-i [command] The -i (simulate initial login) option runs the shell specified by the password database entry of the target user as a login shell. This means that login-specific resource files such as . profile or . login will be read by the shell.

What is sudo to root?

The sudo (superuser do) command is a command-line utility that allows a user to execute commands as the root or a different user. It provides an efficient way to grant certain users the appropriate permissions to use specific system commands or run scripts as the root user.

What is sudo command example?

-h or –help: The -h (help) option causes sudo to print a usage message and exit. 4. -v: If, given the -v (validate) option, sudo will update the user's timestamp, prompting for the user's password if necessary. This extends the sudo timeout for another 5 minutes (or as given in sudoers) but does not run a command.


1 Answers

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.

like image 73
jckly Avatar answered Nov 02 '22 13:11

jckly