IPWorks SSH 2020 Node.js Edition

Questions / Feedback?

FilePermissions Property

The file permissions for the RemoteFile .

Syntax

 scp.getFilePermissions([callback])
 scp.setFilePermissions( filePermissions, [callback])

Default Value

"0600"

Callback

The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).

The callback for the getFilePermissions([callback]) method is defined as:

function(err, data){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'data' is the value returned by the method.

The callback for the setFilePermissions([callback]) method is defined as:

function(err){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'err' has 2 properties which hold detailed information:

err.code
err.message

Remarks

This property defines the permissions that will be assigned to the RemoteFile after an upload. The value is a four digit octal value. This is the same format that is used with the Unix chmod command. The default value of "0600" gives read/write permissions to the file's owner.

The last three octal digits are the most significant and represent, in order, the file access capabilities of the file's owner, the owner's group and other users. Each of these octal digits is, on its own, a 3-bit bitmask with the following possible values:

1 (001)Execute
2 (010)Write
4 (100)Read

An octal permission digit of 7 would have all three values set and would mean that the file can be read, written and executed by that user class. For example, the octal permissions "100644" would have a value "6" for the owner, "4" for the group, and "4" for other users. This would be interpreted to mean that all users can read the file, no users can execute it and only the owner can write it. The permissions "40755" would mean that all users can read and execute the file, but only the owner can write it.

The previous octal digit is another bitmask with the following values:

1 (001)Sticky Bit - retain the file in memory for performance
2 (010)Set GID - sets the group ID of the process to the file's group ID upon execution (only for executable files)
4 (100)Set UID - sets the user ID of the process to the file's user ID upon execution (only for executable files)

Note: Not all servers support setting permissions after an upload.

Data Type

String

Copyright (c) 2023 /n software inc. - All rights reserved.
IPWorks SSH 2020 Node.js Edition - Version 20.0 [Build 8501]