I have copied some directories over sftp on my raspberry pi but I get strange results when trying to access them. I have changed the owner to pi with this command:

sudo chown pi libs/ --recursive

but I cant access chmod without using sudo like this: chmod 0644 libs --recursive and even if I execute this as super user, I still have no access to my directory. Where is the problem?

  • Note the name of a file/directory you can't access and do an ls -l on its parent. – Dmitry Grigoryev Jul 1 '20 at 9:58

What probably happens is, that your directory libs gets chmodded first. Chmodding recursively always requires a bit of attention.

To have access to a directory, it must be executable for you. 0644 means that the directory is not executable, and therefore not accessible.

Instead of your recursive chmod try the following:

find libs -type d -exec chmod 0755 {} \;
find libs -type f -exec chmod 0644 {} \;

type d means directories; type f means all files.

  • Thanks thats working – user11914177 Jun 20 '20 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.