Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
linux:nologin-scp-only [2017/08/28 15:37] – ↷ Page moved from knowhow:nologin-scp-only to linux:nologin-scp-only michael | linux:nologin-scp-only [2017/11/06 14:30] (current) – michael | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== User can only scp files with no shell access ====== | ====== User can only scp files with no shell access ====== | ||
- | '' | + | '' |
+ | <WRAP center box 100%> | ||
===== Konfiguration ===== | ===== Konfiguration ===== | ||
- | - Create a new user (sftptest) and make their shell / | + | - '' |
- | - Add a new group (sftponly) and add the user to that group: < | + | - '' |
# usermod -g sftponly sftptest</ | # usermod -g sftponly sftptest</ | ||
- | - Change permissions of the users home dir to be as follows: < | + | - '' |
# chmod 755 / | # chmod 755 / | ||
- | - Make a directory for the user (sftptest) to be able to scp to (a destination directory): < | + | - '' |
# chown sftptest: | # chown sftptest: | ||
- | - Set the password for the sftptest user. < | + | - '' |
- | - Add the following to / | + | - '' |
ChrootDirectory %h | ChrootDirectory %h | ||
X11Forwarding no | X11Forwarding no | ||
AllowTcpForwarding no | AllowTcpForwarding no | ||
- | ForceCommand internal-sftp </ | + | ForceCommand internal-sftp </ |
* Using the **'' | * Using the **'' | ||
* Or using a single hardcoded directory name -> '' | * Or using a single hardcoded directory name -> '' | ||
* Keep in mind: There is no need, to create an Group, if just one user should be able to have Access. In this case replace "Match group sftponly" | * Keep in mind: There is no need, to create an Group, if just one user should be able to have Access. In this case replace "Match group sftponly" | ||
+ | </ | ||
- | <wrap em>After all changes, restart sshd</ | + | <wrap em>After all changes, restart sshd!</ |
< | < | ||
- | # service sshd restart | + | # systemctl |
</ | </ | ||
+ |