GithubHelp home page GithubHelp logo

isabella232 / fs-admin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from atom/fs-admin

0.0 0.0 0.0 436 KB

Perform file system operations with admin privileges

License: MIT License

Python 4.65% JavaScript 55.13% C++ 38.47% Batchfile 0.35% Dockerfile 1.40%

fs-admin's Introduction

fs-admin

Build Status Build status

Perform file system operations with administrator privileges.

Installing

npm install fs-admin

Packaging (Linux only)

This library uses PolicyKit to escalate privileges when calling createWriteStream(path) on Linux. In particular, it will invoke pkexec dd of=path to stream the desired bytes into the specified location.

PolicyKit

Not all Linux distros may include PolicyKit as part of their standard installation. As such, it is recommended to make it an explicit dependency of your application package. The following is an example Debian control file that requires policykit-1 to be installed as part of my-application:

Package: my-application
Version: 1.0.0
Depends: policykit-1

Policies

When using this library as part of a Linux application, you may want to install a Policy as well. Although not mandatory, policy files allow customizing the behavior of pkexec by e.g., displaying a custom password prompt or retaining admin privileges for a short period of time:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
 "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
<policyconfig>
  <vendor>Your Application Name</vendor>
  <action id="my-application.pkexec.dd">
    <description gettext-domain="my-application">Admin privileges required</description>
    <message gettext-domain="my-application">Please enter your password to save this file</message>
    <annotate key="org.freedesktop.policykit.exec.path">/bin/dd</annotate>
    <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
    <defaults>
      <allow_any>auth_admin_keep</allow_any>
      <allow_inactive>auth_admin_keep</allow_inactive>
      <allow_active>auth_admin_keep</allow_active>
    </defaults>
  </action>
</policyconfig>

Policy files should be installed in /usr/share/polkit-1/actions as part of your application's installation script.

For more information, you can find a complete example of requiring PolicyKit and distributing policy files in the Atom repository.

fs-admin's People

Contributors

daviwil avatar dennisameling avatar dependabot-preview[bot] avatar dependabot[bot] avatar jhutchings1 avatar maxbrunsfeld avatar sadick254 avatar shiftkey avatar vhashimotoo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.