Skip to content
Snippets Groups Projects
Commit 095821d0 authored by joshcarini's avatar joshcarini
Browse files

new page, 'Linux File Permissions', and corresponding screenshots

parent fa75f72f
No related branches found
No related tags found
1 merge request!75new page, 'Linux File Permissions', and corresponding screenshots
+++
title = "Linux File Permissions"
description = "How to view and change file permissions with Linux commands"
weight = 20
+++
- [Opening a Terminal Window] (#opening-a-terminal-window)
- [Listing File Permissions] (#listing-file-permissions)
- [Changing File Permissions] (#changing-file-permissions)
## Opening a Terminal Window
-----------------------
Use your local terminal to connect to a cluster, or open a new terminal window on [Crane](https://crane.unl.edu).
Click [here](https://hcc.unl.edu/docs/quickstarts/connecting/) if you need help connecting to a cluster
with a local terminal.
Click [here](https://hcc.unl.edu/docs/guides/running_applications/jupyter/) if you need
help opening a new terminal window within JupyterHub.
## Listing File Permissions
Type the command `ls -l` to list the files and directories with file permissions for your current location.
{{< figure src="/images/LinuxList.png" >}}
The first character denotes whether an item is a file or a directory. If 'd' is shown, it's a directory, and if '-' is shown, it's a file.
Following the first character you will see some
combination of r,w,x, and -. The first rwx is the ‘read’ ‘write’ ‘execute’ file permissions for the creator
of that file or directory. A ‘-‘ instead means a particular permission has not been granted. For example “rw-“ means the
‘execute’ permission has not been granted. The next three entries are the permissions for ‘group’ and the last three are the
permissions for everyone else.
Following the file permissions are the name of the creator, the name of the group, the size of the file, the date it was created, and finally
the name of the file.
## Changing File Permissions
To change file permissions, use the command "chmod [permissions] [filename]" where permissions are indicated by a three-digit code.
Each digit in the code correspondes to the three digits mentioned above in the permissions printout: One for the creater permissions,
one for the group permissions, and one for everyone else. The command is interpreted as follows: 4=read 2=write 1=execute and any combination of these is given by summing their codes.
Each chmod command will include 3 codes.
For example, to give the creator of mars.txt rights to read, write and execute, the group rights to read and execute, and everone else only the right to read,
we would use the command `chmod 754 mars.txt`
{{< figure src="/images/LinuxChange.png" >}}
static/images/LinuxChange.png

15.2 KiB

static/images/LinuxList.png

7.6 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment