On file and directory permission and ownership: Difference between revisions From Online Manual

Jump to: navigation, search
No edit summary
m (Bot: Automated text replacement (-don't +do not))
Line 6: Line 6:
On Unix-based systems, file permissions are changed using a utility called [[chmod]]. [[What is FTP|FTP]] servers generally provide a local command, also called chmod, to allow setting file permissions via FTP. If you are using an old-style command-line FTP client, you will have to use this command directly. But if you use one of the popular drag-and-drop style FTP clients (like FileZilla, cuteFTP or the FTP client built into Windows Vista and Windows 7), you will be able to view and change file permissions by checking and changing the properties of the files. If your web host provides it, you may be able to log in directly to the account using SSH or telnet and explore your files using Unix shell commands.
On Unix-based systems, file permissions are changed using a utility called [[chmod]]. [[What is FTP|FTP]] servers generally provide a local command, also called chmod, to allow setting file permissions via FTP. If you are using an old-style command-line FTP client, you will have to use this command directly. But if you use one of the popular drag-and-drop style FTP clients (like FileZilla, cuteFTP or the FTP client built into Windows Vista and Windows 7), you will be able to view and change file permissions by checking and changing the properties of the files. If your web host provides it, you may be able to log in directly to the account using SSH or telnet and explore your files using Unix shell commands.


You should have permission to change the permissions on files you own. But you might not own all the files you think you own. In some cases, some of the files in your directories might belong to another user. Some ftp clients don't give you the information about file ownership. You may need to use a command-line based ftp or sftp client, or use SSH or telnet access to see all of this information about the files. On Unix-based operating systems, the chown utility is used to change file ownership. If files are not owned by the user account that should own them, this is often referred to as a chown problem.
You should have permission to change the permissions on files you own. But you might not own all the files you think you own. In some cases, some of the files in your directories might belong to another user. Some ftp clients do not give you the information about file ownership. You may need to use a command-line based ftp or sftp client, or use SSH or telnet access to see all of this information about the files. On Unix-based operating systems, the chown utility is used to change file ownership. If files are not owned by the user account that should own them, this is often referred to as a chown problem.


To learn more about navigation your files using FTP, please read the FAQs [[How do I use FTP]] and [[What is installer/package manager FTP path]].  To find out if your host provides telnet or SSH access to your account, check your host's website or contact technical support.  To learn more about using telnet and SSH, you may wish to check online manuals for these applications.
To learn more about navigation your files using FTP, please read the FAQs [[How do I use FTP]] and [[What is installer/package manager FTP path]].  To find out if your host provides telnet or SSH access to your account, check your host's website or contact technical support.  To learn more about using telnet and SSH, you may wish to check online manuals for these applications.
Line 16: Line 16:
[[Recommendations|Simple Machines recommends]] that you run SMF on a server where suphp or suExec is installed. If suphp or suExec is installed and configured properly on your web server, then all the files in your directory should belong to you, and the webserver will be able to read and write any files you can read and write. When the webserver creates a file in your directory, it belongs to you. In this case, only the file's owner needs permission to write to files and execute directories. CHMOD permission of 644 for files (owner:read+write, group:read, world: read) and 755 for directories (add the ability to "execute" directories) will be sufficient.
[[Recommendations|Simple Machines recommends]] that you run SMF on a server where suphp or suExec is installed. If suphp or suExec is installed and configured properly on your web server, then all the files in your directory should belong to you, and the webserver will be able to read and write any files you can read and write. When the webserver creates a file in your directory, it belongs to you. In this case, only the file's owner needs permission to write to files and execute directories. CHMOD permission of 644 for files (owner:read+write, group:read, world: read) and 755 for directories (add the ability to "execute" directories) will be sufficient.


===When web hosts don't use suphp or suExec===
===When web hosts do not use suphp or suExec===
In this case, you still own files you create using ftp. Every time you use ftp to copy files to the server, they belong to you. But the webserver on these hosts does not run as you. It may run as "nobody", or else as a special username, perhaps "www-data" -- users who don't belong to the same group as your username does. This means that the webserver will not be able to write files in your directories unless you grant world write permission to your files and directories (chmod 777 for directories, 666 for files).  Any new files created don't belong to you. That means that, if you are going to need to work with them later, you'll need to make these files world-writable, and directories world-executable, so that you can edit the webserver's files or delete them from webserver-created directories.
In this case, you still own files you create using ftp. Every time you use ftp to copy files to the server, they belong to you. But the webserver on these hosts does not run as you. It may run as "nobody", or else as a special username, perhaps "www-data" -- users who do not belong to the same group as your username does. This means that the webserver will not be able to write files in your directories unless you grant world write permission to your files and directories (chmod 777 for directories, 666 for files).  Any new files created do not belong to you. That means that, if you are going to need to work with them later, you'll need to make these files world-writable, and directories world-executable, so that you can edit the webserver's files or delete them from webserver-created directories.


===How can file permission and ownership cause problems===
===How can file permission and ownership cause problems===

Revision as of 11:09, 13 June 2013

Installing SMF Packages requires either editing files or adding files and/or directories. Changing a file simply means reading a file, then replacing it with a changed version of the file. All of Package Manager's changes to the SMF software require the permissions to read from and write to files and directories. Sometimes, package installation fails because of file permission problems. This document will attempt to explain some of the common problems and offer some guidance toward resolving them.

File permissions and ownership

On Unix-based systems, file permissions are changed using a utility called chmod. FTP servers generally provide a local command, also called chmod, to allow setting file permissions via FTP. If you are using an old-style command-line FTP client, you will have to use this command directly. But if you use one of the popular drag-and-drop style FTP clients (like FileZilla, cuteFTP or the FTP client built into Windows Vista and Windows 7), you will be able to view and change file permissions by checking and changing the properties of the files. If your web host provides it, you may be able to log in directly to the account using SSH or telnet and explore your files using Unix shell commands.

You should have permission to change the permissions on files you own. But you might not own all the files you think you own. In some cases, some of the files in your directories might belong to another user. Some ftp clients do not give you the information about file ownership. You may need to use a command-line based ftp or sftp client, or use SSH or telnet access to see all of this information about the files. On Unix-based operating systems, the chown utility is used to change file ownership. If files are not owned by the user account that should own them, this is often referred to as a chown problem.

To learn more about navigation your files using FTP, please read the FAQs How do I use FTP and What is installer/package manager FTP path. To find out if your host provides telnet or SSH access to your account, check your host's website or contact technical support. To learn more about using telnet and SSH, you may wish to check online manuals for these applications.

What file permissions do you need

This is where it starts to get complicated. Different web hosts set up your account and the web server in different ways.

SMF's recommended file permission settings

Simple Machines recommends that you run SMF on a server where suphp or suExec is installed. If suphp or suExec is installed and configured properly on your web server, then all the files in your directory should belong to you, and the webserver will be able to read and write any files you can read and write. When the webserver creates a file in your directory, it belongs to you. In this case, only the file's owner needs permission to write to files and execute directories. CHMOD permission of 644 for files (owner:read+write, group:read, world: read) and 755 for directories (add the ability to "execute" directories) will be sufficient.

When web hosts do not use suphp or suExec

In this case, you still own files you create using ftp. Every time you use ftp to copy files to the server, they belong to you. But the webserver on these hosts does not run as you. It may run as "nobody", or else as a special username, perhaps "www-data" -- users who do not belong to the same group as your username does. This means that the webserver will not be able to write files in your directories unless you grant world write permission to your files and directories (chmod 777 for directories, 666 for files). Any new files created do not belong to you. That means that, if you are going to need to work with them later, you'll need to make these files world-writable, and directories world-executable, so that you can edit the webserver's files or delete them from webserver-created directories.

How can file permission and ownership cause problems

  • You install SMF via FTP so the files belong to you, but the webserver runs as someone other than you, or nobody , and so it cannot edit files via Package Manager.

Setting

  • You install SMF via FTP so the files belong to you, and the webserver is supposed to run as you, but it has "accidentally" caused some files created via Package Manager to be created that are not owned by you, and now neither it nor you can do anything with them.
  • Other cases?

Causes and solutions for some common SMF problems

Cases

  • Package Manager says it installed a mod correctly, but the mod is obviously not there
    • Cause
    • Solution
  • Package Manager says it installed a mod correctly, and the mod seems to be only half there
    • Cause
    • Solution


Advertisement: