Post Reply 
(HP-65) Unix Permissions (chmod) Calculator
12-28-2019, 12:15 AM
Post: #1
(HP-65) Unix Permissions (chmod) Calculator
This program can be used to individually toggle permission bits to build up an octal "string" representing the net permissions for a file. This value can be fed directly to the chmod command. It does not do anything fancy like applying umask, merging ACLs, etc. Also, the 65 doesn't have an alpha screen, so there's no corresponding decoder to display what you would see in ls -l (e.g. "rwxr-xr-x").

Recommended key labels:

A:
user
r/suid

B:
group
w/sgid

C:
other
x/sticky

D:
special
store

E:
show

Usage

Start by loading the program, and use f REG or at least clear R1. Alternatively, you may enter a 1-4 digit octal value representing the permissions to start with, followed by D, D to store the value.

Toggling permission (or special) bits is done by pressing A-D in sequences of two keys. The first key selects the category (user, group, other, special, written on the top row of the key label), and the second key selects the permission/special bit (r, w, x, suid, sgid, sticky, written on the bottom row). Bits that are turned off will be turned on, and those already turned on will be turned back off. After pressing the second key, the updated permission value will be displayed in x.

To later recall the current octal value for the permissions (if you've cleared the stack or done other intermediate work), press E.

Example

Calculate the permissions to set for a file with user r/w/x, group r/x, and set-user-ID enabled.

f REG
A A : 400
A B : 600
A C : 700
B A : 740
B C : 750
D A : 4750

You could then use "chmod 4750 adminscript.sh" for a group-accessible admin script that needs to execute as the owning user (e.g. root).

Code:
LBL
A
6
4
GTO
1
LBL
B
8
GTO
1
LBL
C
1
GTO
1
LBL
D
5
1
2
LBL
1
RTN
LBL
D
R↓
f⁻¹
→OCT
STO 1
GTO
E
LBL
A
4
GTO
7
LBL
B
2
GTO
7
LBL
C
1
LBL
7
×
ENTER↑
ENTER↑
RCL 1
g x↔y
÷
f
INT
2
÷
f⁻¹
INT
0
f⁻¹
SF 1
g x≠y
f
SF 1
R↓
R↓
f
TF 1
CHS
g NOP
STO
+
1
LBL
E
DSP
.
0
RCL 1
f
→OCT
RTN
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(HP-65) Unix Permissions (chmod) Calculator - Dave Britten - 12-28-2019 12:15 AM



User(s) browsing this thread: 1 Guest(s)