IgnorantGuru's Blog

Linux software, news, and tips

Script: permz

«Downloads

Download Links:
Script: downloadbrowseauthenticateinstructions
Debian/Ubuntu: packagesPPA
Arch Linux: AUR
Description: Presents a menu for quickly changing file permissions/ownership
Recommended For: Linux
Requires: zenity gksu (also recommended: sudo)
License: GNU GPL v3     * SEE DISCLAIMER *
Related: pcmanfm-mod
Feedback: commentsissues

Overview

permz presents a GUI menu which allows you to quickly change file permissions and ownership as a normal user or as root, and delete files as root. permz is designed to be integrated into any file manager, such as PCManFM-Mod.

permz --help

Presents a GUI menu for changing file permissions/ownership.  May be run
as a normal user or root.
Requires: zenity gksu
Optional: sudo (recommended to prevent multiple root password prompts)
Usage: permz FILE [...]

MENU FUNCTIONS:
rwxrwxrwx            Sets file(s) to given permissions
Sticky Clear/Set     Performs "chmod -t" or +t to clear or set the sticky
                     bit.  You may select to clear/set sticky in addition
                     to changing other permissions.
Recursive go-rxw     "chmod -R go-rxw" on file(s) recursively, denying
                     access to non-owners
Recursive go-w       "chmod -R go-w" on file(s) recursively, denying write
                     to non-owners
Recursive ugo+rX     "chmod -R ugo+rX" giving read access to all.  Also
                     sets +x for directories and executables.
Recursive ugo+w      "chmod -R ugo+w" on file(s), giving write to all
  (You may select several compatible recursive functions above at once)
Owner USER As ROOT   Sets ownership to USER:USER as root
DELETE As ROOT       Deletes file(s) as root.  Must be used alone or with
                     "Perform Recursively" (to delete directories - USE
                     WITH CAUTION). Not available if permz is run as root.
Perform As ROOT      Run as root to change selected permissions.
                     (Use of root is automatic when changing ownership)
Perform Recursively  Adds -R to all chmod, chown, and delete commands to
                     descend into subdirectories.  Use in conjunction with
                     any other functions.  (Recursion is automatic for
                     "Recursive" functions above)

Current su command is set to: gksu -gS

If your file manager allows you to define user commands, you can simply set permz to open all selected files. (See instructions for adding permz to PCManFM-Mod.) Otherwise, you can associate permz with all file types and use your file manager’s “Open With…” menu to run it. You can also simply run permz from a console window.

Almost all file managers already allow you to change file permissions, but the mechanism is usually buried on a second tab of the Properties window, and changing permissions often involves multiple clicks in a grid. To change the owner of a file, you need to type the username. And if the file is owned by root, you can’t do anything.

permz allows you to set file permissions and ownership with single clicks, and it can perform the changes as root. While permz does not allow you to change permissions to all possible combinations, it includes the most common settings. When these aren’t sufficient, you can still use the default mechanism of your file manager.

 

Installation Instructions


Follow the standard Script Installation Instructions. Alternatively, for Debian and Ubuntu a deb package and a PPA repository are available. On Arch Linux, permz can be installed automatically using the AUR.

Before running permz, install required packages using your package manager. For example, on Debian/Ubuntu:

apt-get install zenity gksu

By default, permz uses gksu for functions performed as root. If sudo is installed, it will have gksu use sudo as its backend. This is recommended because it avoids your having to enter the root password multiple times for combined functions.

You can also change the su command to your preferred program at the top of the script. You may need to test and adjust how strings are passed to your command.

You can also adjust the size of the pop-up window at the top of the script. Depending on your default GTK font size you may want to make the window smaller or larger.

permz is a bash script, and is thus easily customized. If you are reasonably familiar with bash, it’s straightforward to change the default functions to whatever you prefer. Be sure to test thoroughly after modifying the script.

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 139 other followers