.Dd Created:2026-03-26|Updated:2026-03-26| .de ocsi \\$* , .. .de oxr .ocsi .Xr \\$* .. .de oit .It \\$* .. .de obdi .Bl -dash -compact .oit \\$* .. .de obdl .Bd -literal -compact \\$* .. .de onote .Bl -hang -compact .oit \\$* .El .. .de ocomm .Bl -diag -compact .oit \\$* .El .. .de opsy .Pp .Sy - \\$* .. .de obc .Bl -column \\$* .. .de obc2 .obc opt desc .. .de obc3 .obc option arguments description .. .Dt PERMISSIONS oh .Os OpenBSD 7.8 , linux | .Nm permissions .Nd assign and modify file permissions. .Sh TYPES Permission types can be an octal number or an symbols. .obc3 .It Sy Type Ta | Sy Octal Ta | Sy Symbol .It None Ta | 0 Ta | .It Execution Ta | 1 Ta | x .It Write Ta | 2 Ta | w .It Read Ta | 4 Ta | r .El Permissions can be assigned by adding the octal values or assigning the symbols. .Ss Example .obdi Write (2) + Read (4) = 6 .oit w+r .El .Sh ASSIGNMENT When a user creates a file or directory, it's assigned as the owner, and its main group is assigned as the owner group. .Ss Format The permissions are displayed with the following format: owner, group owner, other groups, all users. Example: .obdl $ whoami user1 $ groups users $ ls -l -rwxr-xr-- 1 user1 users .... file1 .Ed .obdi user1 is the owner and has permissions to read, write and execute. .oit The users corresponding to the group "users" have permissions to read and execute. .oit Users from other groups have permissions to read. .oit The corresponding octal value is 754. .Sh COMMANDS .Ss Important Users can modify permissions on files if they have write permissions. .Ss chown Modifies the owner of a file or directory. .obc2 .It Modify user Ta : Li chown username filename .It Modify user and group Ta : Li chown username:groupname filename .El To modify recursively, use -R. .Ss chmod Changes the permissions on a file or directory as explained in Sx TYPES. To assign (=), add (+) or remove (-) permissions, the who symbols can be used for user (u), group (g) or other (o). .obc2 .It Sy Change Ta | Sy Command .It Octal assignment Ta | Li chmod 755 file .It Add write permissions for group Ta | Li chmod g+w file .It Assign read and write permissions to others Ta | Li chmod o=rw file .It Remove read permission to other groups and users Ta | Li chmod o-r file .El When using the octal value or assigning using =, the previous permissions are overwritten. .Ss chgrp .Dl chgrp -R GROUP DIRECTORY .Sh TODO .obdi Add sticky bit and execute bit. .El .Sh SEE ALSO .Xr user_management oh .opsy OpenBSD manpages: .oxr chmod 1 .oxr chgrp 1 .Xr chown 8 .Sh AUTHORS .An -nosplit .Xr ohazot oh | .Xr about oh | .Lk https://ohazot.com ohazot.com .Aq Mt admin@ohazot.com