October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Make a Folder Accessible to an SSH User on Linux

A practical Linux guide to granting SSH and SFTP folder access with dedicated groups, ACLs, correct parent traversal, key safety, and chrooted uploads.
Length9 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Give an SSH account access by granting its Linux UID the minimum required combination of owner, group, mode-bit, ACL, and path-traversal rights. For a reusable shared folder, put the account in a dedicated group, assign that group to the folder, and enable setgid inheritance. For one account only, use an ACL. For an upload-only transfer account, combine a root-owned SFTP chroot with a writable child directory.

What SSH folder access actually means

SSH authenticates a normal Linux account; it does not create a separate permission system for remote sessions. Once logged in, the kernel evaluates the account’s UID, supplementary groups, traditional mode bits, ACL entries, and the permissions on every directory in the path.

As an Amazon Associate I earn from qualifying purchases.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Directory permissions have different meanings from file permissions:

  • Read (r) on a directory allows listing its names.
  • Execute (x) allows traversal: entering the directory, accessing a known name, and using it as part of a path.
  • Write (w) allows creating, deleting, and renaming entries when combined with execute permission. It does not by itself make existing files readable or writable.

Therefore, a user who can read a file still needs execute permission on the file’s directory and on every parent directory above it. A user who must upload needs write and execute on the upload directory, plus traversal through all parents. Granting read permission alone is not enough to list or open a file if a parent directory blocks traversal.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Choose the access model before changing permissions

Requirement Best-fit design What it changes Isolation and maintenance
Several trusted accounts need the same folder Dedicated Unix group Group ownership and group mode bits Simple to reuse; membership grants the same rights to every group member
One account needs access without changing the existing group POSIX ACL A named-user ACL entry and its mask Precise per-user control; inspect with getfacl
Account needs a shell and ordinary filesystem access Unrestricted SSH path Normal Linux permissions apply Most flexible, least isolated
Account should transfer files only internal-sftp with ChrootDirectory Session command and filesystem root More isolation; chroot ownership rules are strict
Users must upload but not alter the directory boundary Root-owned boundary plus writable child Only the child is writable by the account Prevents the SFTP account from modifying the jail itself

Decide whether access is read-only or read/write, whether users should share changes, and whether a shell is needed. Do not give write permission merely to solve a read or traversal error.

Set up a shared folder with a dedicated group

Assume the account is sshuser and the shared path is /srv/shared. Run these commands as an administrator.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Create a group.
    sudo groupadd folderusers
  2. Add the SSH account to it.
    sudo usermod -aG folderusers sshuser
    Use -aG, not just -G; omitting -a can replace the user’s existing supplementary groups.
  3. Assign the folder’s group.
    sudo chown -R owner:folderusers /srv/shared
    This keeps owner as the primary owner while making folderusers the group on the tree. Confirm that changing the group is acceptable before applying it recursively.
  4. Choose group read-only or group read/write access.
    sudo chmod 2750 /srv/shared gives the owner read/write/traverse and the group read/traverse access. The leading 2 sets the setgid bit, so new entries inherit the directory’s group.
    Use sudo chmod 2770 /srv/shared when group members must create, change, or remove entries in that directory.
  5. Apply directory and file modes separately. A recursive chmod that gives every object the same mode can accidentally make files executable or directories unusable. For a read-only group tree, an example is:
    sudo find /srv/shared -type d -exec chmod 2750 {} +
    sudo find /srv/shared -type f -exec chmod 0640 {} +
    For a group-writable tree, use directory mode 2770 and a suitable non-executable file mode such as 0660, subject to the application’s needs.
  6. Start a new login session. Supplementary groups are normally read when the session starts. Disconnect and reconnect before testing; an already-open shell may not contain folderusers.

Check the resulting identity and ownership with:

id sshuser
ls -ld /srv/shared

The id output should include folderusers. If it does not, reconnect again or investigate the account and NSS configuration rather than widening directory permissions.

Grant one account access with ACLs

Use an ACL when changing the directory’s primary group would affect other services or users. The following grants sshuser read and traversal rights on the shared directory, then full directory rights on an upload area:

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
sudo setfacl -m u:sshuser:rx /srv/shared
sudo setfacl -m u:sshuser:rwx /srv/shared/incoming
getfacl /srv/shared /srv/shared/incoming

The first entry lets the account traverse and read the directory; the second permits creating and modifying entries in incoming. The account still needs execute permission on every parent directory between its login and the target. Add narrowly scoped ACL entries to those parents when required, rather than giving broad access to unrelated directories.

Always inspect the ACL mask in getfacl. A named-user entry can appear to grant rwx while the mask limits its effective rights. The getfacl output shows both the requested entry and any effective restriction. ACLs also do not bypass a parent directory that denies traversal.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Diagnose path traversal one component at a time

When a path looks correctly permissioned but SSH reports “Permission denied,” inspect every component, not just the final folder:

namei -l /srv/shared/incoming

namei -l displays the owner and mode for /, /srv, /srv/shared, and /srv/shared/incoming. Look for a parent where sshuser has no execute permission through owner, group, or ACL. A private home directory, for example, can block access to a correctly configured descendant.

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Test the exact effective rights as the target account instead of testing as root:

sudo -u sshuser -- test -x /srv/shared
sudo -u sshuser -- test -r /srv/shared/file
sudo -u sshuser -- test -w /srv/shared/incoming

These commands return success silently and a nonzero status on failure. They separate traversal, read, and write problems so you can fix only the missing permission.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep SSH key authentication healthy

Folder permissions are irrelevant if sshd refuses the account’s key before the session starts. OpenSSH normally looks for .ssh/authorized_keys relative to the account’s home directory unless AuthorizedKeysFile has been overridden.

  • The account’s home directory, .ssh directory, and authorized_keys file should be owned appropriately by the account or an administrator responsible for the account.
  • They must not be writable by unrelated users. With StrictModes enabled, unsafe ownership or modes can cause sshd to reject a key even when the target folder has perfect permissions.
  • The OpenSSH client guidance likewise expects ~/.ssh to be accessible to the user and not broadly accessible to others, with strict protection for private key material.

If authentication fails, first determine whether the failure occurs before a shell opens. Use verbose client output such as ssh -vv and inspect the server log for key or StrictModes errors. Only after authentication succeeds should you troubleshoot the target folder.

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Build an SFTP-only account with a chroot

For a transfer-only account, constrain the session in sshd_config with a user-specific match block:

Match User sshuser
    ForceCommand internal-sftp
    ChrootDirectory /srv/sftp/%u
    DisableForwarding yes
    PermitTTY no

ForceCommand internal-sftp prevents the user from starting a normal shell. DisableForwarding yes blocks forwarding features for this match, and PermitTTY no prevents allocation of a terminal. The %u token expands to the authenticated username, so this example expects a jail at /srv/sftp/sshuser.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Prepare the jail boundary

The chroot path and every component above it must be root-owned directories that are not writable by any other user or group. This is an OpenSSH requirement, not an optional hardening preference. A typical layout is:

sudo install -d -o root -g root -m 755 /srv/sftp
sudo install -d -o root -g root -m 755 /srv/sftp/sshuser
sudo install -d -o sshuser -g sshuser -m 700 /srv/sftp/sshuser/incoming

The account cannot write to the chroot boundary itself. It can write inside incoming, which is owned by the account in this example. You can use an ACL on that child instead if ownership must remain with another service.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

Understand the two common chroot mistakes

  • Writable chroot boundary: If the jail directory or any component above it is group- or world-writable, OpenSSH rejects the connection rather than entering the jail.
  • No writable child: If the boundary is correctly root-owned but every child is also read-only, authentication and SFTP startup can succeed while uploads fail. Create and permission a child such as incoming.

After editing the configuration, validate it before reloading:

sudo sshd -t

A silent result indicates that the syntax check passed. Fix any reported error before reloading or restarting the daemon, and keep an existing administrative session open while changing SSH configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Verify the real client operation

Use this sequence after changing groups, ACLs, or SSH configuration:

  1. Run sudo sshd -t to catch configuration errors.
  2. Run id sshuser in a fresh session to confirm group membership.
  3. Run namei -l /srv/shared/incoming (or the actual target) to inspect every path component.
  4. Run getfacl on any path using ACLs and check the mask and effective permissions.
  5. Run the three sudo -u sshuser -- test ... checks for traversal, read, and write.
  6. Use the actual client operation: ssh -vv sshuser@host for shell access or sftp sshuser@host for transfers. Try listing the directory, reading a permitted file, creating a small test file, and deleting it if deletion is part of the intended role.

Testing as root, as the directory owner, or from an old shell can produce a false positive. The meaningful test is the same account, through the same SSH or SFTP path, performing the operation it is meant to perform.

Fix the most common “permission denied” cases

Symptom Likely cause Targeted fix
Account cannot enter a folder Missing execute permission on the folder or a parent Use namei -l; grant only the required parent traversal with group mode bits or an ACL
Account can enter but cannot list names Directory lacks read permission Add read permission to the relevant group or named-user ACL; retain execute for traversal
Account can list but cannot upload Target directory lacks write permission, or an ACL mask limits it Grant rwx on the upload directory and verify the mask with getfacl
Group change appears ineffective Session predates the supplementary-group change Disconnect and start a new SSH session, then rerun id sshuser
Key is rejected before the folder is reached Home, .ssh, or authorized_keys is unsafe under StrictModes Correct ownership and modes, then review verbose client output and server logs
SFTP login is rejected immediately Chroot path or an ancestor is not root-owned, or is writable by group/others Make every boundary component root-owned and non-writable; keep writes in a child directory
SFTP login succeeds but upload fails No writable child exists inside the jail Create a child such as incoming and grant the account ownership or a suitable ACL
Configuration reload fails Syntax error in sshd_config Run sudo sshd -t, correct the reported line, and validate again before reloading

Operate the permission scheme safely

  • Grant the smallest useful permission set: read and execute for viewing, write only where the account must create or change entries, and no shell or forwarding features for a transfer-only role.
  • Use a dedicated group when several accounts should receive identical rights. Review membership because adding a user to that group grants access to the entire group-controlled tree.
  • Use ACLs for exceptions, and document named-user entries so they are not mistaken for ordinary mode bits during later maintenance.
  • Use setgid on shared directories when new entries should inherit the collaboration group. Check applications’ umasks and file-creation behavior so newly created files receive the intended group access.
  • Keep chroot boundaries administrative and immutable to the SFTP account; put all writable content below the boundary.
  • Preserve an existing administrative SSH session while testing a configuration change, and validate with sshd -t before reloading the daemon.

The resulting design should be explainable in one sentence: identify the account, state whether access is read-only or read/write, name the group or ACL that grants it, and identify the exact writable directory if the account is jailed.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.