linux:nologin-scp-only

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux:nologin-scp-only [2017/08/28 15:39] – [Konfiguration] michaellinux: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 ======
-''Ein lokaler User, soll sich legendlich auf dem Server in einem für ihn eingerichteten Ordner via SCP einloggen und dort seine files kopieren, löschen und verwalten können.''+''Ein lokaler User, soll sich legendlich auf dem Server in einem für ihn eingerichteten Ordner via SCP einloggen und dort seine files kopieren, löschen und verwalten können. <wrap em>(Er darf sich nicht auf eine Shell verbinden!)</wrap>''
  
 <WRAP center box 100%> <WRAP center box 100%>
 ===== Konfiguration ===== ===== Konfiguration =====
-  - Create a new user (sftptest) and make their shell /sbin/nologin: <code># useradd -s /sbin/nologin sftptest</code> +  - ''Create a new user (sftptest) and make their shell /sbin/nologin:'' <code># useradd -s /sbin/nologin sftptest</code> 
-  - Add a new group (sftponly) and add the user to that group: <code># groupadd sftponly+  - ''Add a new group (sftponly) and add the user to that group:'' <code># groupadd sftponly
 # usermod -g sftponly sftptest</code> # usermod -g sftponly sftptest</code>
-  - Change permissions of the users home dir to be as follows: <code># chown root:root /home/sftptest+  - ''Change permissions of the users home dir to be as follows:'' <code># chown root:root /home/sftptest
 # chmod 755 /home/sftptest </code> # chmod 755 /home/sftptest </code>
-  - Make a directory for the user (sftptest) to be able to scp to (a destination directory): <code># mkdir /home/sftptest/incoming+  - ''Make a directory for the user (sftptest) to be able to scp to (a destination directory):'' <code># mkdir /home/sftptest/incoming
 # chown sftptest:sftptest /home/sftptest/incoming </code> # chown sftptest:sftptest /home/sftptest/incoming </code>
-  - Set the password for the sftptest user. <code> # passwd sftptest </code> +  - ''Set the password for the sftptest user.'' <code> # passwd sftptest </code> 
-  - Add the following to /etc/ssh/sshd_config: <code> # vim /etc/ssh/sshd_config </code> <sxh bash; first-line: 1> Match group sftponly+  - ''Add the following to /etc/ssh/sshd_config:'' <code> # vim /etc/ssh/sshd_config </code> <sxh bash; first-line: 1> Match group sftponly
         ChrootDirectory %h         ChrootDirectory %h
         X11Forwarding no         X11Forwarding no
Line 25: Line 25:
  
 <code> <code>
-service sshd restart+systemctl restart sshd
 </code> </code>
  
  • linux/nologin-scp-only.1503927561.txt.gz
  • Last modified: 2017/08/28 15:39
  • by michael