Unix Permissions: chmod 777 - chmod 755 - chmod 666
Everyone at times needs to change the permissions on a file through a shell client like Putty even though you may be able to do this through your FTP / WS FTP. However you may still want or need to change file permissions through your a shell client like PuTTY. One can find a bit of enjoyment by stroking its own PuTTY.
Every file or directory on your UNIX machine has settings on who can read, write or execute that file. These are the permissions set on the file.
Below I have put together the basics of changing the ownership of a file and the commands to use.
In your unix shell window cd to the location of the file or directory you want to chmod. If the file name is hello.php then type chmod 777 hello.php or chmod 777 directory. Easy enough, the file permissions have been changed.
Most used chmod commands used:
chmod 777 filename or directory
chmod 755 filename or directory
chmod 666 filename or directory
What the basic file permissions mean: (the file owner is the user that uploaded the file)
chmod 755 : Read / Execute for everyone and write access for the file owner.
More: This changes the permissions on the file or directory to allow everyone to read or execute the file, and only the file owner is allowed to write to the file or write to that directory.
chmod 777 : Read / Write / Execute access for everyone.
More: This changes the permissions on the file or directory to allow everyone to read, execute, and write to the file or directory.
chmod 666 : Read / Write for everyone and execute access for the file owner.
More: This changes the permissions on the file or directory to allow everyone to read or write to the file or directory, and only the file owner is allowed to execute the file.
Extra Help With The chmod Command:
chmod 777 *.html (changes permission on any file name ending with the extension you put in. Such as *.html or *.php or *.jpg)
chmod 777 *.* (changes permission on all files with extensions in the directory)
chmod -R 755 directory/ (changes permission on all files & directories within that directory)
The -R means recursive.
Changing File Ownership:
Sometimes you may need to change the ownership of a file. Meaning, which logged in user is able to modify the files or directories. You may need to change the ownership of files back to your main user account if you moved files logged in as root.
This is rather simple to do. First you need to be logged in as root.
Just type: chown username file or directory
*If your normal ftp account username is Random1 and the directory is www you would type: chown Random1 www Now the files can be modified by user: Random1
More Advanced Permission & Other Info:
CatCode: Chmod Tutorial
PerFect: Understanding Unix Permissions
Online tool to help with file permission commands Easy & Quick
* Check out our Unix Command Cheat Sheet tutorial for a large listing & descriptions of UNIX commands.
Good Luck,
~ TheDoc





TrackBack URI:
Talking About: Unix File Permissions - CHMOD