Handle operating system tasks such as user management, packages and services management.
Create a group in the system
Create a new user
Disable root login
Run this to make it so that the root user no longer can login
over SSH. This increases the security of the machine.
Note: make sure the super user has been setup successfully first.
Disable an user account
Disable a user from logging in.
Check if a group exists
Harden the machine
Show information about the OS
Install any pkg
Pkg name as positional argument.
Always provide Debian names.
Install the 'sudo' pkg
Make an existing user into sudo
Create/replace motd file
Reboot the system
- limits
Control a service
Enter into shell
Update the OS package lists
Update and upgrade OS
Check if a user exists
Check for dependencies
Get the OS identification and package manager.
- out_ostype
- out_ospkgmgr
- out_oshome - Users home dir.
- out_oscwd - Current CWD.
Show some information about the current OS.
Check if program is installed.
If not installed then install its package, if provided.
- $1: program name
- $2: package name
- 0: program is available
- 0: program is not available and failed to install it
Translates Debian style package names into
the current OS package manager naming.
A translation could be translated into one or many
package names.
- ${pkg}: package(s) name(s) to adjust
Translates Debian style program names into
the current OS distributions program naming.
- ${program}: program name to translate
Install one or more packages.
Give the Debian style name of packages
and the function will attempt to translate
it to the current package managers name for it.
- $1: package(s) name(s)
- 0: success
- 1: failed to install package either due to unknown package manager or package name
Update the system package lists.
Upgrade the system.
- Non-zero on error.
Control a service.
- $1: service name
- $2: action
- 0: success
- 1: failure
Reboot the system.
Check if a user does exist.
- $1: the name of the user to lookup.
- 0: users does exist
- 1: failure. User does NOT exist
Check if a group does exist.
- $1: the name of the group to lookup.
- 0: group does exist
- 1: failure. Group does NOT exist
Create passwordless user and install ssh key for it.
- $1: The name of the user to create.
- $2: Path of the pub key file to install for the user.
- 0: success
- 1: failure
Add a user, with a home directory.
- $1: user name
- $2: home path directory
- $3: shell path
- 0: success
- 1: failed to call useradd/adduser
Add a group to the system
- $1: group name
- 0: success
- 1: failed to call groupadd
-
$1: command to look for
-
Return:
-
Same as 'command'
Make a user passwordless SUDO.
- $1: The name of the user to make into sudo user.
- 0: success
- 1: failure
Add a given user to a group
- $1: user name
- $2: group name
- Non-zero on error.
Copy a motd file into the system.
Message of the day is the greeting text that shows when you login.
Parameters;
$1: The path of the motd file to upload.
Disable root from logging in both via ssh and physically.
- 0: success
- 1: failure
Disable a user from logging in both via ssh and physically.
- $1: The name of the user to make inactive.
- 0: success
- 1: failure
Enter userland shell or exec command.
- $1: shell name (optional).
- $@: optional commands to run in shell.
Kill all descendant processes to given PID.
- $1: PID to kill descendants for
- $2: Include PID it self, default 1.
- non-zero on error
Configure resource limits
- $1: domain name (username or groupname, for instance)
- $2: type of resource limit (soft or hard)
- $3: resource item name
- $4: value to attribute to resource item