Confirming umask and chmod Commands Are Supported
Some of the procedures in this note use the UNIX chmod and umask commands. Follow these steps to see if the umask and chmod commands are supported by your server:
- Using the Reflection FTP Client, establish a connection to your host.
- Click View, Command Window.
- Type quote site help or quote help site in the Command Window. The command varies depending on the server.
- Check whether CHMOD and UMASK are listed in the output. If they are present, proceed to the remaining sections of this note. If they are not present, your server does not support these commands, and you cannot use the Reflection FTP Client to set file attributes.
For more information on chmod and umask commands, see your UNIX man pages.
Setting Attributes of Existing Server Files
You can set attributes using the user interface or the chmod command.
Setting Attributes Using the User Interface
To use the Reflection FTP Client graphical interface to change UNIX file permissions:
- Right-click the desired server file or directory (or select and right-click multiple files or directories). Click Properties.
- Use the check boxes to set Owner, Group, and Public attributes. (Alternatively, you can enter a three digit number for Permission Mask, which is calculated as described in the Calculating chmod Numeric Values section below.) Click OK.
Setting Attributes Using the chmod Command
Follow these steps to use the chmod command to change UNIX file permissions:
- Calculate the octal value for the desired file attributes as described in the Calculating chmod Numeric Values section below.
- In the Reflection FTP Client Command Window, type quote site chmod <mode> <filename>. The value for <mode> is the three-digit octal value calculated in Step 1.
Note: Changes made to directories are not recursive; that is, they do not affect the files or subdirectories within the directory.
Setting Attributes for New Server Files
There are several ways to set attributes for newly created server files.
Setting Attributes for Newly Created Files Using the User Interface
Use any of these options in the FTP Client user interface to determine how the client handles attributes for uploaded files:
- To set default attributes for all uploads use Tools > Options > Attributes > Set default attributes on uploads.
- To be prompted for file permission attributes each time you upload a file to a site, use Site Properties > Transfer tab > Show upload options before transfer.
- If your server supports umask, you can set an Initial umask value in Site Properties > Connection tab. Refer to the Calculating chmod Numeric Values section and subtract the chmod value from 777 to determine the mask value. For example, 777-664=113. Note: This umask option is not available for SFTP connections.
Setting Attributes for Newly Created Files Using the umask Command
Follow these steps to use the umask command to set default read, write, and execute rights for new files you will upload to the server:
- Calculate the octal value for the attributes you wish to set. Refer to the Calculating chmod Numeric Values section.
- Calculate the mask by subtracting the value derived in Step 1 from 777. For example, 777-664=113.
- In the Reflection FTP Client Command Window, type quote site umask <nnn>. The value for <nnn> is the umask value calculated in Step 2.
- Upload files as usual. New files will be created with the desired attributes.
Note: Typically, if you specify umask execute attributes, they will only be set for new directories you create. Use the chmod command to set execute attributes for files.
Viewing Attributes of Existing Server Files
In Reflection FTP Client, there are two ways to check attributes of existing files.
- Right-click the desired file. Select Properties.
- On the General tab, the Attributes are listed at the bottom.
- Connect to your host.
- From the View menu, select Right Pane or Sever Pane(s), then Details. You may need to resize the window or use the horizontal scroll bar to view the file attributes.
Calculating chmod Numeric Values
Some of the procedures in this technical note require calculating the chmod octal "mode" value. This is calculated by adding the values shown in the following table.
||read by owner
||write by owner
||execute (search in directory) by owner
||read by group
||write by group
||execute/search by group
||read by others
||write by others
||execute/search by others
For example, the octal value for rw-rw-r-- rights is 664 (400+200+40+20+4=664).
Tip: You can also use the server file Properties dialog box to determine chmod octal values as well as to modify server file permissions. Right-click any server file to display this dialog box. The dialog box includes check boxes for setting Owner, Group, and Public permissions. As you select and unselect options, the octal value for the currently selected permissions displays in the Permission Mode text box.