share

Shares restricted access to objects

Usage

./uplink.exe share [ALLOWED_PATH_PREFIX]... [flags]
./uplink.exe share [ALLOWED_PATH_PREFIX]... [flags]

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

Flags

FlagDescription
--access stringthe serialized access, or name of the access to use
--auth-service stringurl for shared auth service (default "https://auth.storjshare.io")
--base-url stringthe base URL for link sharing (default "https://link.storjshare.io")
--disallow-deletesif true, disallow deletes
--disallow-listsif true, disallow lists
--disallow-readsif true, disallow reads
--disallow-writesif true, disallow writes
--dns stringspecify your custom hostname. if set, returns dns settings for web hosting. implies --register and --public
--export-to stringpath to export the shared access to
--help, -hhelp for share
--not-afterdisallow access after this time (e.g. '+2h', '2020-01-02T15:01:01-01:00')
--not-beforedisallow access before this time (e.g. '+2h', '2020-01-02T15:01:01-01:00')
--max-object-ttlThe object is automatically deleted after this period. (e.g. '1h30m', '24h', '720h')
--publicif true, the access will be public. --dnsand --urloverride this
--readonlyimplies --disallow-writes and --disallow-deletes
--registerif true, creates and registers access grant
--urlif true, returns a url for the shared path. implies --register and --public
--writeonlyimplies --disallow-reads and --disallow-lists

Examples

Share a single object

./uplink.exe share sj://cakes/cheesecake.jpg
./uplink.exe share sj://cakes/cheesecake.jpg

Notice that by default, only download (read) and list operations are allowed.

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

Share a bucket with all permissions

./uplink.exe share sj://cakes/ --readonly=false
./uplink.exe share sj://cakes/ --readonly=false

As the --readonly flag is set to false, uploads and deletes are allowed.

=========== ACCESS RESTRICTIONS ==========================================================
Download : Allowed
Upload : Allowed
Lists : Allowed
Deletes : Allowed
NotBefore : No restriction
NotAfter : No restriction
MaxObjectTTL : Not set
Paths : sj://cakes/
=========== SERIALIZED ACCESS WITH THE ABOVE RESTRICTIONS TO SHARE WITH OTHERS ===========
Access : 12BncZWg9xc4GyXCgCi3YvBg...
=========== ACCESS RESTRICTIONS ==========================================================
Download : Allowed
Upload : Allowed
Lists : Allowed
Deletes : Allowed
NotBefore : No restriction
NotAfter : No restriction
MaxObjectTTL : Not set
Paths : sj://cakes/
=========== SERIALIZED ACCESS WITH THE ABOVE RESTRICTIONS TO SHARE WITH OTHERS ===========
Access : 12BncZWg9xc4GyXCgCi3YvBg...

Register with Gateway MT

Generate credentials to use with our S3 multitenant gateway: Getting started

./uplink.exe share sj://cakes/ --register
./uplink.exe share sj://cakes/ --register

Notice the endpoint generated for Gateway MT: https://gateway.storjshare.io.

=========== ACCESS RESTRICTIONS ==========================================================
Download : Allowed
Upload : Disallowed
Lists : Allowed
Deletes : Disallowed
NotBefore : No restriction
NotAfter : No restriction
MaxObjectTTL : Not set
Paths : sj://cakes/ (entire bucket)
=========== SERIALIZED ACCESS WITH THE ABOVE RESTRICTIONS TO SHARE WITH OTHERS ===========
Access : 1Q74vfxunqiAQ15WPxPqreya...
========== CREDENTIALS ===================================================================
Access Key ID: jvguri...
Secret Key : j3nj4x...
Endpoint : https://gateway.storjshare.io
=========== ACCESS RESTRICTIONS ==========================================================
Download : Allowed
Upload : Disallowed
Lists : Allowed
Deletes : Disallowed
NotBefore : No restriction
NotAfter : No restriction
MaxObjectTTL : Not set
Paths : sj://cakes/ (entire bucket)
=========== SERIALIZED ACCESS WITH THE ABOVE RESTRICTIONS TO SHARE WITH OTHERS ===========
Access : 1Q74vfxunqiAQ15WPxPqreya...
========== CREDENTIALS ===================================================================
Access Key ID: jvguri...
Secret Key : j3nj4x...
Endpoint : https://gateway.storjshare.io

You can also generate a URL to share your projects/buckets/objects

./uplink.exe share sj://cakes/ --url --not-after=none
./uplink.exe share sj://cakes/ --url --not-after=none

Note that specifying --base-url is optional, but the --not-after is mandatory. If you do not want to specify date or offset - you can specify --not-after=none.

See share for details.

=========== ACCESS RESTRICTIONS ==========================================================
Download : Allowed
Upload : Disallowed
Lists : Allowed
Deletes : Disallowed
NotBefore : No restriction
NotAfter : No restriction
MaxObjectTTL : Not set
Paths : sj://cakes/ (entire bucket)
=========== SERIALIZED ACCESS WITH THE ABOVE RESTRICTIONS TO SHARE WITH OTHERS ===========
Access : 1Q74vfxunqiAQ15WPxPqreya...
========== CREDENTIALS ===================================================================
Access Key ID: jvguri...
Secret Key : j3nj4x...
Endpoint : https://gateway.storjshare.io
Public Access: true
=========== BROWSER URL ==================================================================
REMINDER : Object key must end in '/' when trying to share recursively
URL : https://link.storjshare.io/s/jvguri.../cakes
=========== ACCESS RESTRICTIONS ==========================================================
Download : Allowed
Upload : Disallowed
Lists : Allowed
Deletes : Disallowed
NotBefore : No restriction
NotAfter : No restriction
MaxObjectTTL : Not set
Paths : sj://cakes/ (entire bucket)
=========== SERIALIZED ACCESS WITH THE ABOVE RESTRICTIONS TO SHARE WITH OTHERS ===========
Access : 1Q74vfxunqiAQ15WPxPqreya...
========== CREDENTIALS ===================================================================
Access Key ID: jvguri...
Secret Key : j3nj4x...
Endpoint : https://gateway.storjshare.io
Public Access: true
=========== BROWSER URL ==================================================================
REMINDER : Object key must end in '/' when trying to share recursively
URL : https://link.storjshare.io/s/jvguri.../cakes

Also note that the URL uses the same Gateway MT access key, so if you have that already, you don't necessarily need to run this command to generate a shareable link.

https://link.storjshare.io/s/<access key>/<object path>

To download content directly, use /raw/ in Linkshare URL ex: https://link.storjshare.io/raw/jxkfryh6anmtrcfhtio4q5lszuza/media%2FBig%20Buck%20Bunny%20Demo.mp4

To view the object location map, use /s/ in Linkshare URL ex: https://link.storjshare.io/s/jxkfryh6anmtrcfhtio4q5lszuza/media%2FBig%20Buck%20Bunny%20Demo.mp4

Webhosting

For more detail, visit the documentation on Static site hosting.

While you may share individual objects with the above linksharing instructions, you must share a bucket or object prefix for webhosting. Your web address will render the index.html file.

./uplink.exe share --dns www.mysite.com sj://cakes/
./uplink.exe share --dns www.mysite.com sj://cakes/
=========== ACCESS RESTRICTIONS ==========================================================
Download : Allowed
Upload : Disallowed
Lists : Allowed
Deletes : Disallowed
NotBefore : No restriction
NotAfter : No restriction
MaxObjectTTL : Not set
Paths : sj://cakes/ (entire bucket)
=========== SERIALIZED ACCESS WITH THE ABOVE RESTRICTIONS TO SHARE WITH OTHERS ===========
Access : 12BncZWg9xc4GyXCDX73...
========== CREDENTIALS ===================================================================
Access Key ID: ju3ga56lfk7x...
Secret Key : j2psszecoqtc...
Endpoint : https://gateway.storjshare.io
Public Access: true
=========== DNS INFO =====================================================================
Remember to update the $ORIGIN with your domain name. You may also change the $TTL.
$ORIGIN example.com.
$TTL 3600
www.mysite.com IN CNAME link.storjshare.io.
txt-www.mysite.com IN TXT storj-root:cakes
txt-www.mysite.com IN TXT storj-access:ju3ga56lfk7x...
=========== ACCESS RESTRICTIONS ==========================================================
Download : Allowed
Upload : Disallowed
Lists : Allowed
Deletes : Disallowed
NotBefore : No restriction
NotAfter : No restriction
MaxObjectTTL : Not set
Paths : sj://cakes/ (entire bucket)
=========== SERIALIZED ACCESS WITH THE ABOVE RESTRICTIONS TO SHARE WITH OTHERS ===========
Access : 12BncZWg9xc4GyXCDX73...
========== CREDENTIALS ===================================================================
Access Key ID: ju3ga56lfk7x...
Secret Key : j2psszecoqtc...
Endpoint : https://gateway.storjshare.io
Public Access: true
=========== DNS INFO =====================================================================
Remember to update the $ORIGIN with your domain name. You may also change the $TTL.
$ORIGIN example.com.
$TTL 3600
www.mysite.com IN CNAME link.storjshare.io.
txt-www.mysite.com IN TXT storj-root:cakes
txt-www.mysite.com IN TXT storj-access:ju3ga56lfk7x...

Use the generated DNS info to connect your domain name to your shared objects.

Note you can use any hostname in place of www.mysite.com in the example. The base-url is also optional.

Previous
setup
Next
Access