For directories, execute permission allows you to enter the directory (i.e., cd into it), and to access any of its files.
cd needs execution permission of the directory which it applies to, because cd calls system call function chdir() which requires it.
Why I can't I cd into the /var/www directory? cd is a shell built-in so sudo can't be used. And even if it could be used, it would be pointless. There is generally no way to make another process change its working directory, so whatever the cd executable could do, it couldn't change the shell process' cwd.
Only a root user or user with sudo access can change the permissions for the file or directory you want to access or execute. If you are the correct user to make the required permission changes, you can run the “chmod” command and add the desired permission.
@user812954's answer was quite helpful, except I had to do this this in two steps:
sudo su
cd directory
Then, to exit out of "super user" mode, just type exit
.
Enter super user mode, and cd into the directory that you are not permissioned to go into. Sudo requires administrator password.
sudo su
cd directory
If it is a directory you own, grant yourself access to it:
chmod u+rx,go-w openfire
That grants you permission to use the directory and the files in it (x
) and to list the files that are in it (r
); it also denies group and others write permission on the directory, which is usually correct (though sometimes you may want to allow group to create files in your directory - but consider using the sticky bit on the directory if you do).
If it is someone else's directory, you'll probably need some help from the owner to change the permissions so that you can access it (or you'll need help from root
to change the permissions for you).
chmod +x openfire
worked for me. It adds execution permission to the openfire folder.
Alternatively, you can do:
sudo -s
cd directory
You've got several options:
x
ecute permissions on that directory.x
ecute permissions.
chmod(1)
to change the permissions orsetfacl(1)
command to add an access control list entry for your user account. (This also requires mounting the filesystem with the acl
option; see mount(8)
and fstab(5)
for details on the mount parameter.)It's impossible to suggest the correct approach without knowing more about the problem; why are the directory permissions set the way they are? Why do you need access to that directory?
Unless you have sudo permissions to change it or its in your own usergroup/account you will not be able to get into it.
Check out man chmod
in the terminal for more information about changing permissions of a directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With