Skip to content

Instantly share code, notes, and snippets.

@meunierd
Created October 8, 2014 14:55
Show Gist options
  • Save meunierd/788f8dd377af9e10eb1f to your computer and use it in GitHub Desktop.
Save meunierd/788f8dd377af9e10eb1f to your computer and use it in GitHub Desktop.
S3FS Wrapper -- sets file permissions properly
#!/usr/bin/env python
import re
import sys
from subprocess import check_output, call
def current_uid_gid():
user = check_output(['id']).split()[:2]
digit = lambda id_: int(re.search(r'\d+', id_).group())
return map(digit, user)
def main():
uid, gid = current_uid_gid()
args = ['s3fs'] + sys.argv[1:] + ['-ouid=%d' % uid, '-ogid=%d' % gid]
call(args)
if __name__ == '__main__':
sys.exit(main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment