systemd-my-smb

1.2.0 • Public • Published

systemd-my-smb

Systemd-my-smb is a command line application that will automatically create systemd unit files to mount SMB user share(s). Whether you are new to Linux or wanting to automate mount your shares, systemd-my-smb is here to help you manage your smb systemd unit files.

Installation

$ npm i -g systemd-my-smb

Examples

No credentials

$ systemd-my-smb --smb-host MYSERVER --shares photos,movies,books --enable-units --start-units

Username and Password

$ systemd-my-smb --smb-host MYSERVER --shares photos,movies,books --enable-units --start-units --permissions rw --user myuser --password 0ABadPass!

Credentials File (Recommended)

$ systemd-my-smb --smb-host MYSERVER --shares photos,movies,books --enable-units --start-units --permissions rw --credential-file /home/myuser/.myserver_credentials

Unmount and Remove Shares

$ systemd-my-smb --smb-host MYSERVER --shares photos,movies,books --clean

Options

Arguments Description Example
-V, --version Outputs the systemd-my-smb application version. -V
-h, --help Outputs the systemd-my-smb application options and descriptions. -h
-H, --smb-host Required. Hostname or IP Address of SMB Server to Mount shares from. -H MyShare.local
-s, --shares Required. A comma separated list of shares to mount from the SMB host. -s photos,videos
-d, --root-directory Root directory for shares. Will automatically attempt to create {root directory}/{SMB hostname}/{share name}. Default: /home/{username} -d /smb_shares
-ud, --systemd-unit-directory Directory to store systemd unit files within. Default: /etc/systemd/system -ud /etc/systemd/system
-eu, --enable-units Enables SMB units after creation. -eu
-su, --start-units Starts SMB units after creation. -su
-A, --automount Creates automount unit files (asynchronous on demand mounting). Do not confuse with mounting on startup. Read more [here](https://www.man7.org/linux/man-pages/man5/systemd.automount.5.html). -A
-eo, --extra-options Extra options for unit mount. Default: "" -eo {mount option}
-cs, --char-set Character set option for smb mount. Default: utf8 -cs utf8
-p, --permissions Mount permission for smb mount. Default: ro -p rw
-fm, --file-mode File mode for smb mount. Default: 0755 -fm 0777
-dm, --directory-mode Directory mode for smb mount. Default: 0755 -dm 0777
-to, --timeout Timeout, in seconds, for smb mount. Default: 30 -to 10
-mr, --mount-as-root Mounts shares as root. Default behavior mounts shares as user running systemd-my-smb. -mr
-cf, --credential-file Path to credential file to use for mount. User, domain, and password options ignored when using credential file. Default: "" -cf /home/myuser/.mysmb_credentials
-u, --user SMB username for mount. Default: "" -u myuser
-pw, --password SMB password for mount. Note: Please consider using a credential file over this option. Default: "" -pw 0aBadPassword!
-do, --domain SMB domain for mount. Default: "" -do workgroup
-C, --clean Stops, disables, and removes units generated for shares. Ignores all options for adding shares when enabled. -C

Development

Running in development mode

To run in development just use npm run dev and supply your arguments.

$ npm run dev -- --smb-host MYSERVER --shares photos,movies,books

Updating dependencies

Run npm run update-dependencies which will upgrade all packages in package.json, install, and update package-lock.json.

Publishing Releases

Systemd-my-smb uses release-it for releasing. Use the following syntax for releases: npm run release major|minor|patch.

Tests

Where are the tests!? This project was started with the goal of no transpilation while using native module support in Node. Unfortunately, there are only experimental ways to mock these modules. Without proper mocking support, testing is on hold.

Package Sidebar

Install

npm i systemd-my-smb

Weekly Downloads

1

Version

1.2.0

License

GPL-3.0

Unpacked Size

67.2 kB

Total Files

14

Last publish

Collaborators

  • shabubu