| Tested on | RHEL 10.2 (Coughlan) on vm1.lab.example |
|---|---|
| Package | openssh-server, sssd-ad, realmd |
| Applies to | RHEL 10 and Rocky Linux 10 hosts joined to AD with SSSD |
| Privilege | sudo for sshd and filesystem changes |
| Scope | Secure file transfer for AD users over SFTP (SSH subsystem) when the host already uses SSSD for identity. Covers prerequisites, sshd defaults, home directories, permissions, optional Match restrictions, and client tests. Does not cover Samba shares or vsftpd FTP. |
| Related guides | Join RHEL to AD with realmd and SSSD vsftpd with AD (legacy) Samba shares for AD users OpenSSH authentication methods SSH config file examples |
SFTP is provided by OpenSSH, so you do not need a separate FTP server.
When the RHEL host is already joined to Active Directory through SSSD, an AD user such as jane@lab.example can normally use SFTP through the same SSH authentication stack.
For new file-transfer setups on RHEL 10, use SFTP instead of building a new FTP/vsftpd deployment.
Quick answer
SFTP client
↓
sshd
↓
AD password → PAM → SSSD → Active Directory
or
SSH public key
↓
User home directoryPassword authentication reaches Active Directory through PAM and SSSD. Public-key authentication is handled by SSH separately.
Prerequisite: realmd + SSSD domain join with client-software: sssd.
Test environment
| Item | Value |
|---|---|
| OS | RHEL 10.2, vm1.lab.example, 192.168.56.116 |
| Domain | lab.example |
| User | jane@lab.example |
| Client test | sftp -o User='jane@lab.example' vm1.lab.example |
Verify Active Directory identity
Before changing anything in SSH, make sure the Linux host is still joined to AD through SSSD:
realm listIn the output, check that client-software is sssd. The login-formats line also tells you which username format SSSD expects.
Check that the AD user resolves on the host:
id jane@lab.exampleNow check how Linux sees the AD account. getent shows the user’s UID, group, home directory, and login shell:
getent passwd jane@lab.examplejane@lab.example:*:758601105:758600513::/home/jane@lab.example:/bin/bashHere, Jane’s home directory is /home/jane@lab.example. That is where a normal SFTP session will start.
Restrict which AD users may connect
If the server uses realm permit to restrict AD logins, make sure the SFTP user is allowed:
sudo realm permit jane@lab.exampleFor several users, permit an AD group instead of adding accounts one at a time:
sudo realm permit -g 'network-admins@lab.example'If id finds the user but login still fails, check the realm access policy before changing SSH settings.
Verify OpenSSH and the SFTP subsystem
Make sure sshd is running before you test:
sudo systemctl enable --now sshdRHEL can load SSH settings from both sshd_config and files under sshd_config.d. Use sshd -T to see the settings that are actually in effect:
sudo sshd -T | grep -E 'usepam|passwordauthentication'Check that the SFTP subsystem is defined:
grep -R '^Subsystem.*sftp' /etc/ssh/sshd_config /etc/ssh/sshd_config.d/ 2>/dev/nullSubsystem sftp /usr/libexec/openssh/sftp-serverThis line tells sshd which SFTP server program to start when an SFTP client connects.
Verify automatic home directory creation
AD users normally do not have a local home directory until their first login. If the with-mkhomedir authselect feature is enabled, PAM creates it automatically:
authselect currentYou should see with-mkhomedir among the enabled features.
oddjobd performs the actual directory creation, so make sure it is running:
systemctl is-active oddjobdactiveAfter Jane logs in once, check that her home directory exists:
ls -ld "/home/jane@lab.example"The user needs write permission here if you expect uploads into the home directory.
For shared team directories outside $HOME, use group ownership on a dedicated path—similar to Samba shares for AD users without smbd.
Open the firewall for SSH
SFTP uses the same TCP port as SSH: port 22. If firewalld is enabled, allow the predefined SSH service:
sudo firewall-cmd --permanent --add-service=sshReload firewalld so the rule takes effect:
sudo firewall-cmd --reloadTest normal SFTP first
Test a normal SFTP login before adding any Match or chroot rules. That way, if something fails later, you know the basic AD and SFTP setup was already working.
Because the AD username already contains @, pass it with -o User= so it is clear where the username ends and the hostname begins:
sftp -o User='jane@lab.example' vm1.lab.exampleIf you want to test directly from the RHEL server, connect to localhost:
sftp -o User='jane@lab.example' 127.0.0.1At the sftp> prompt, print the working directory, upload a file, and list:
sftp> pwd
Remote working directory: /home/jane@lab.example
sftp> put /etc/hostname sftp-ad-test.txt
sftp> ls
sftp-ad-test.txtIf the upload succeeds, the full path is working: SSH accepted the user, the account passed the AD/SSSD checks, and the user can write to the destination directory.
Windows admins often use WinSCP with username jane@lab.example and the server hostname vm1.lab.example.
Optional: make an AD group SFTP-only
Match Group applies special SSH settings to members of that group. In this example, members of network-admins@lab.example are forced into SFTP instead of getting a shell. It does not stop other users from using SFTP unless you add separate access restrictions.
SSH must use the same group name that Linux sees. Check it before creating the Match Group rule:
getent group 'network-admins@lab.example'Example drop-in /etc/ssh/sshd_config.d/sftp-only-group.conf:
Match Group network-admins@lab.example
ForceCommand internal-sftp
DisableForwarding yesValidate syntax before reload:
sudo sshd -tKeep your current admin SSH session open while you test a new Match block so you can revert a mistake that locks you out.
If sshd -t returns no errors, reload SSH:
sudo systemctl reload sshdOptional: chroot SFTP-only users
Chroot is advanced. Use the normal home workflow above first.
OpenSSH requires the chroot path and every parent component to be root-owned and not writable by the user. Because the user cannot own or modify the chroot directory itself, create a writable subdirectory such as upload inside it.
Example layout for one AD user:
sudo mkdir -p "/srv/sftp/jane@lab.example/upload"The chroot directory itself must be root-owned with mode 755; only the upload child is writable by the AD user:
sudo chown root:root "/srv/sftp/jane@lab.example"
sudo chmod 755 "/srv/sftp/jane@lab.example"
sudo chown 'jane@lab.example':'domain users@lab.example' "/srv/sftp/jane@lab.example/upload"Now apply the chroot only to Jane (drop-in or main sshd config):
Match User jane@lab.example
ChrootDirectory /srv/sftp/%u
ForceCommand internal-sftp
DisableForwarding yesRun sudo sshd -t, then sudo systemctl reload sshd. Test SFTP from a second session before you close your admin connection.
If you want to chroot an entire AD group, first verify the group name with getent group. Each user still needs a root-owned chroot directory and a separate writable directory inside it.
Troubleshooting
| Symptom | Likely cause | What to check |
|---|---|---|
| Connection refused | sshd or firewall |
systemctl status sshd; firewall-cmd |
| Permission denied (publickey) | Server is not allowing password login, or no valid key is available | sshd -T and passwordauthentication; configured SSH keys |
| Password rejected | AD/SSSD access policy or wrong password | id user@domain; realm list; realm permit |
| Upload fails | Directory ownership, mode, or SELinux | ls -ld; ls -Zd; AVC logs with ausearch -m avc |
Summary
Once RHEL can already authenticate AD users through SSSD, SFTP usually needs very little extra setup. OpenSSH handles the file-transfer session, while PAM and SSSD continue to handle AD password authentication.
Start with a normal SFTP login to the user’s home directory. Add Match, SFTP-only restrictions, or chroot directories only when your use case actually needs them.
Use vsftpd with SSSD only when a legacy client still requires FTP. Use Samba when the workload is SMB from Windows, not SFTP.
References
Frequently Asked Questions
Can Active Directory users use SFTP on RHEL?
Yes, when the host is joined with SSSD and sshd allows their authentication method.
Is SFTP the same as FTP over SSH?
No. SFTP is an SSH subsystem; FTP uses a separate protocol and server such as vsftpd.
Do I need Winbind for SFTP with AD?
No. SSSD is the usual integration for SSH and SFTP on a general-purpose Linux server.
Why does SFTP fail when id works?
Check realm permit, SSH authentication settings, and permissions on the target directory.

