How to fix fatal: Unable to read current working directory: Permission denied (snap confinement) in Git

GitBEGINNERMEDIUMUpdated Dec 6, 2025· 228 views

This error occurs when Git installed via snap cannot access your working directory due to snap's strict sandboxing. Snap packages have limited filesystem access by default, and certain directories require explicit permission grants or alternative installation methods.

Quick fix

Fixes fatal: Unable to read current working directory: Permission denied (snap confinement)

# Check if git is a snap package
which git
# If output is /snap/bin/git, it's a snap installation

# Or check directly
snap list git
  1. Verify Git is installed via snap
  2. Connect the home interface
  3. Connect the removable-media interface for external drives
  4. Fix non-standard home directory paths
git — error
# Check if git is a snap package
which git
# If output is /snap/bin/git, it's a snap installation
# Or check directly
snap list git
fatal: Unable to read current working directory: Permission denied (snap confinement)

What this error means

When you install Git using Ubuntu's snap package manager, the application runs inside a security sandbox called "strict confinement." This sandbox restricts Git's access to the filesystem for security purposes, preventing it from reading or writing to directories outside its allowed scope. The snap confinement system uses a combination of AppArmor, seccomp, mount namespaces, and cgroups to isolate applications. By default, snap applications can only access: - Their own installation directory - Non-hidden files in your home directory (requires the `home` interface to be connected) - Removable media (only when the `removable-media` interface is connected) When Git tries to access a directory that falls outside these boundaries—such as hidden directories, mounted drives, `/tmp`, `/mnt`, or non-standard home directory paths—the snap sandbox blocks the access and Git reports this permission denied error. This is a security feature, not a bug. However, it can be frustrating when you legitimately need Git to access these locations for your development work.

Typical symptoms

  • Git commands fail with 'fatal: Unable to read current working directory: Permission denied'
  • Error occurs only with snap-installed Git, not with apt-installed Git
  • Git works in ~/Documents but fails in /mnt, /media, or /tmp directories
  • Git cannot access hidden directories like ~/.config or ~/.ssh
  • Git fails when working directory is on a mounted network drive or external storage
  • Error appears after switching from apt-installed Git to snap-installed Git
  • Git works for some users but not for users with non-standard home directory paths (e.g., domain users)

Common causes

  1. Working directory is outside the snap sandbox's allowed paths (most common)
  2. The 'home' interface is not connected, blocking access to the home directory
  3. Working in hidden directories (starting with .) which the home interface does not cover
  4. Working on mounted storage where the 'removable-media' interface is not connected
  5. Non-standard home directory path not recognized by AppArmor (e.g., /home/DOMAIN/user)
  6. Working in /tmp, /var, or other system directories not accessible to strict snaps

How to fix "fatal: Unable to read current working directory: Permission denied (snap confinement)"

1Verify Git is installed via snap

First, confirm that your Git installation is from snap:

bash
# Check if git is a snap package
which git
# If output is /snap/bin/git, it's a snap installation

# Or check directly
snap list git

If Git is installed via apt (/usr/bin/git), this error has a different cause—see related errors for other permission issues.

2Connect the home interface

The most common fix is to ensure the home interface is connected, granting Git access to your home directory:

bash
# Check current interface connections
snap connections git

# Connect the home interface
sudo snap connect git:home :home

After connecting, verify the connection:

bash
snap connections git
# Should show: home  git:home  :home  -

Note: The home interface only grants access to non-hidden files. If you need access to .git directories or .gitconfig, additional steps may be needed.

3Connect the removable-media interface for external drives

If you're working on mounted drives, USB storage, or network shares (typically under /mnt or /media), connect the removable-media interface:

bash
# Connect removable-media interface
sudo snap connect git:removable-media :removable-media

# Verify the connection
snap connections git

This grants Git access to:
- /media - automounted removable storage
- /mnt - manually mounted filesystems
- /run/media - runtime media mounts

4Fix non-standard home directory paths

If your home directory uses a non-standard path (common with domain/LDAP users like /home/MYDOMAIN/username), you need to update AppArmor's home directory configuration:

bash
# Edit the AppArmor home tunables
sudo nano /etc/apparmor.d/tunables/home.d/ubuntu

# Add your domain path (create file if it doesn't exist)
@{HOMEDIRS}+=/home/MYDOMAIN/

Then restart the necessary services:

bash
sudo systemctl restart apparmor
sudo systemctl restart snapd

Replace MYDOMAIN with your actual domain or directory name.

5Switch to apt-installed Git (recommended for developers)

If you frequently work outside the snap sandbox boundaries, the simplest solution is to use apt-installed Git instead:

bash
# Remove snap version
sudo snap remove git

# Install via apt
sudo apt update
sudo apt install git

# Verify installation
git --version
which git
# Should show /usr/bin/git

The apt-installed Git runs without confinement and can access any directory your user has permission to access. This is generally recommended for development work where you need maximum filesystem flexibility.

6Install Git snap with classic confinement (if available)

Some snaps offer a "classic" confinement mode that removes sandbox restrictions. Check if Git supports this:

bash
# Try installing with classic confinement
sudo snap install git --classic

Note: As of current snap store policies, the main Git snap may not support classic confinement. If this command fails, use the apt installation method instead.

Classic confinement effectively gives the snap full system access, similar to traditional packages.

7Verify the fix

After applying your chosen fix, test Git in the previously failing directory:

bash
# Navigate to the problematic directory
cd /path/to/your/directory

# Test basic Git commands
git status
git log --oneline -5

# If cloning, test that too
git clone https://github.com/example/repo.git test-repo

If you still see permission errors, check which interfaces are connected:

bash
snap connections git

And verify your current user can access the directory:

bash
ls -la /path/to/your/directory

Advanced notes

### Understanding Snap Confinement Levels

Snap packages can have three confinement levels:

1. Strict (default): Full sandbox with explicit interface permissions required
2. Classic: No sandbox, full system access (requires Store approval)
3. Devmode: Development mode with relaxed restrictions (not for production)

The Git snap uses strict confinement for security, which is why permission issues arise.

### Available Interfaces for Git

Check all available interfaces for Git:

bash
snap connections git --all

Common interfaces that may help:
- home: Access to non-hidden files in $HOME
- removable-media: Access to /mnt, /media, /run/media
- ssh-keys: Access to SSH keys for remote operations
- gpg-keys: Access to GPG keys for signed commits
- personal-files: Access to specific hidden files (requires special approval)

### Why Hidden Files Are Restricted

The home interface intentionally excludes hidden files (those starting with .) because these often contain sensitive data like credentials, SSH keys, and application secrets. Accessing them requires the personal-files interface, which needs explicit approval from the Snap Store.

For Git specifically, this means the snap may have trouble accessing:
- ~/.gitconfig - Git configuration
- ~/.ssh - SSH keys for authentication
- ~/.gnupg - GPG keys for signing

This is a significant limitation for development workflows.

### When to Use Snap vs Apt for Git

Use apt-installed Git when:
- You need access to mounted drives or network shares
- You work with hidden directories
- You have a non-standard home directory
- You need maximum compatibility with your workflow

Use snap-installed Git when:
- You want automatic updates
- You need a newer Git version than apt provides
- You're on a system where apt is not available
- Security isolation is a priority

### Debugging AppArmor Denials

If you want to see exactly what AppArmor is blocking:

bash
# View recent AppArmor denials
sudo dmesg | grep -i apparmor | tail -20

# Or check the audit log
sudo journalctl -k | grep -i denied

This can help identify which specific paths or operations are being blocked.

Frequently asked questions

What does "fatal: Unable to read current working directory: Permission denied (sn" mean?
" This sandbox restricts Git's access to the filesystem for security purposes, preventing it from reading or writing to directories outside its allowed scope. The snap confinement system uses a combination of AppArmor, seccomp, mount namespaces, and cgroups to isolate applications. By default, snap applications can only access: - Their own installation directory - Non-hidden files in your home directory (requires the home interface to be connected) - Removable media (only when the removable-media interface is connected) When Git tries to access a directory that falls outside these boundaries—such as hidden directories, mounted drives, /tmp, /mnt, or non-standard home directory paths—the snap sandbox blocks the access and Git reports this permission denied error.
How do I fix "fatal: Unable to read current working directory: Permission denied (sn"?
This error occurs when Git installed via snap cannot access your working directory due to snap's strict sandboxing. Snap packages have limited filesystem access by default, and certain directories require explicit permission grants or alternative installation methods.
What causes "fatal: Unable to read current working directory: Permission denied (sn"?
Working directory is outside the snap sandbox's allowed paths (most common) The 'home' interface is not connected, blocking access to the home directory Working in hidden directories (starting with .) which the home interface does not cover
Is the "fatal: Unable to read current working directory: Permission denied (sn" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading