Steps to Check Folder Permissions on EC2
Connect to Your EC2 Instance via SSH
First, connect to your EC2 instance using SSH. Replace /path/to/your-key.pem with the path to your SSH key, and your-ec2-instance-public-dns with the public DNS of your EC2 instance.
ssh -i /path/to/your-key.pem ubuntu@your-ec2-instance-public-dns
Navigate to the Parent Directory
If you need to check the permissions of a specific folder, navigate to its parent directory. For example, if you want to check the permissions of the storage folder within your Laravel project:
cd /var/www/html/your-laravel-project
Check Directory Permissions
Use the ls -ld command to check the permissions of the directory. Replace directory-name with the name of your directory.
ls -ld directory-name
For example, to check the permissions of the storage directory:
ls -ld storage
Understanding the Output
The output will look something like this:
drwxrwxr-x 5 www-data www-data 4096 Jun 7 10:00 storage
Here's what each part of the output means:
drwxrwxr-x: The permissions of the directory.
d: Indicates that it is a directory.
rwxrwxr-x: Indicates the permissions. These are split into three groups:
rwx: The owner (user) has read (r), write (w), and execute (x) permissions.
rwx: The group has read (r), write (w), and execute (x) permissions.
r-x: Others have read (r) and execute (x) permissions.
5: The number of hard links to the directory.
www-data: The owner (user) of the directory.
www-data: The group of the directory.
4096: The size of the directory in bytes.
Jun 7 10:00: The last modification date and time of the directory.
storage: The name of the directory.
Checking Permissions of All Subdirectories
To check the permissions of all subdirectories and files within a directory, use:
ls -l directory-name
For example, to check the permissions of all files and subdirectories within the storage directory:
ls -l storage
Example
# Connect to your EC2 instance
ssh -i /path/to/your-key.pem ubuntu@your-ec2-instance-public-dns
# Navigate to your project directory
cd /var/www/html/your-laravel-project
# Check permissions of the storage directory
ls -ld storage
# Check permissions of all subdirectories and files within the storage directory
ls -l storage