Storj IconSTORJ | DCS Docs
Create an Access to an Object

Create an Access to an Object #

There are several ways to share access to an object:

Share an object #

You can create an access using the uplink share command using Restrictions. For example:

./uplink.exe share sj://cakes/cheesecake.jpg --export-to cheesecake.access
uplink share sj://cakes/cheesecake.jpg --export-to cheesecake.access
uplink share sj://cakes/cheesecake.jpg --export-to cheesecake.access

The --export-to flag is used to export the access to a file. This gives the following output:

=========== ACCESS RESTRICTIONS ==========================================================
Download  : Allowed
Upload    : Disallowed
Lists     : Allowed
Deletes   : Disallowed
NotBefore : No restriction
NotAfter  : No restriction
Paths     : sj://cakes/cheesecake.jpg
=========== SERIALIZED ACCESS WITH THE ABOVE RESTRICTIONS TO SHARE WITH OTHERS ===========
Access    : 12yUGNqdsKX1Xky2qVoGwdpL...
Exported to: cheesecake.access

Restrict an access #

The command uplink access restrict allows you to create a restricted access grant using Restrictions.

An access generated using uplink access restrict with no arguments creates an access to your entire project with read permissions!

Example:

./uplink.exe access restrict --not-after=+10h --prefix sj://cakes/NewYork
uplink share --readonly=false --not-before=+2h --not-after=+10h sj://cakes/
uplink share --readonly=false --not-before=+2h --not-after=+10h sj://cakes/
17UjiCXa...
See the uplink access restrict command reference for more actions.

Restrictions #

The --readonly flag prevents all write operations (delete and write). Similarly, the --writeonly flag prevents all read operations (read and list).

By default, the access is read-only. To give full permissions, use --readonly=false

You may also indicate the duration of access by specifying a start and end time.

The list of all restrictions can be found here.
Example:

./uplink.exe share --readonly=false --not-before=+2h --not-after=+10h sj://cakes/
uplink share --readonly=false --not-before=+2h --not-after=+10h sj://cakes/
uplink share --readonly=false --not-before=+2h --not-after=+10h sj://cakes/
=========== ACCESS RESTRICTIONS ==========================================================
Download  : Allowed
Upload    : Allowed
Lists     : Allowed
Deletes   : Allowed
NotBefore : 2021-04-17 17:22:39
NotAfter  : 2021-04-18 01:22:39
Paths     : sj://cakes/ (entire bucket)
=========== SERIALIZED ACCESS WITH THE ABOVE RESTRICTIONS TO SHARE WITH OTHERS ===========
Access    : 123qSBBgSUSqwUdbJ6n4bxLM...
See the uplink access restrict and uplink share commands reference for more actions.